package: fix segfault of iwinfo.scanlist("radio0").
[openwrt/openwrt.git] / package / network / utils / iwinfo / src / iwinfo_lua.c
index 23d72d9bdb0b62a31f540cf831230b1b7653fc06..cdb90d5b4783bb3f95ce38a831204240a275fceb 100644 (file)
@@ -362,7 +362,7 @@ static int iwinfo_L_txpwrlist(lua_State *L, int (*func)(const char *, char *, in
 /* Wrapper for scan list */
 static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int *))
 {
-       int i, x, len;
+       int i, x, len = 0;
        char rv[IWINFO_BUFSIZE];
        char macstr[18];
        const char *ifname = luaL_checkstring(L, 1);
@@ -611,31 +611,31 @@ static int iwinfo_L_countrylist(lua_State *L, int (*func)(const char *, char *,
 
 #ifdef USE_WL
 /* Broadcom */
-LUA_WRAP_INT(wl,channel)
-LUA_WRAP_INT(wl,frequency)
-LUA_WRAP_INT(wl,frequency_offset)
-LUA_WRAP_INT(wl,txpower)
-LUA_WRAP_INT(wl,txpower_offset)
-LUA_WRAP_INT(wl,bitrate)
-LUA_WRAP_INT(wl,signal)
-LUA_WRAP_INT(wl,noise)
-LUA_WRAP_INT(wl,quality)
-LUA_WRAP_INT(wl,quality_max)
-LUA_WRAP_STRING(wl,ssid)
-LUA_WRAP_STRING(wl,bssid)
-LUA_WRAP_STRING(wl,country)
-LUA_WRAP_STRING(wl,hardware_name)
-LUA_WRAP_STRING(wl,phyname)
-LUA_WRAP_STRUCT(wl,mode)
-LUA_WRAP_STRUCT(wl,assoclist)
-LUA_WRAP_STRUCT(wl,txpwrlist)
-LUA_WRAP_STRUCT(wl,scanlist)
-LUA_WRAP_STRUCT(wl,freqlist)
-LUA_WRAP_STRUCT(wl,countrylist)
-LUA_WRAP_STRUCT(wl,hwmodelist)
-LUA_WRAP_STRUCT(wl,encryption)
-LUA_WRAP_STRUCT(wl,mbssid_support)
-LUA_WRAP_STRUCT(wl,hardware_id)
+LUA_WRAP_INT_OP(wl,channel)
+LUA_WRAP_INT_OP(wl,frequency)
+LUA_WRAP_INT_OP(wl,frequency_offset)
+LUA_WRAP_INT_OP(wl,txpower)
+LUA_WRAP_INT_OP(wl,txpower_offset)
+LUA_WRAP_INT_OP(wl,bitrate)
+LUA_WRAP_INT_OP(wl,signal)
+LUA_WRAP_INT_OP(wl,noise)
+LUA_WRAP_INT_OP(wl,quality)
+LUA_WRAP_INT_OP(wl,quality_max)
+LUA_WRAP_STRING_OP(wl,ssid)
+LUA_WRAP_STRING_OP(wl,bssid)
+LUA_WRAP_STRING_OP(wl,country)
+LUA_WRAP_STRING_OP(wl,hardware_name)
+LUA_WRAP_STRING_OP(wl,phyname)
+LUA_WRAP_STRUCT_OP(wl,mode)
+LUA_WRAP_STRUCT_OP(wl,assoclist)
+LUA_WRAP_STRUCT_OP(wl,txpwrlist)
+LUA_WRAP_STRUCT_OP(wl,scanlist)
+LUA_WRAP_STRUCT_OP(wl,freqlist)
+LUA_WRAP_STRUCT_OP(wl,countrylist)
+LUA_WRAP_STRUCT_OP(wl,hwmodelist)
+LUA_WRAP_STRUCT_OP(wl,encryption)
+LUA_WRAP_STRUCT_OP(wl,mbssid_support)
+LUA_WRAP_STRUCT_OP(wl,hardware_id)
 #endif
 
 #ifdef USE_MADWIFI
@@ -669,31 +669,31 @@ LUA_WRAP_STRUCT_OP(madwifi,hardware_id)
 
 #ifdef USE_NL80211
 /* NL80211 */
-LUA_WRAP_INT(nl80211,channel)
-LUA_WRAP_INT(nl80211,frequency)
-LUA_WRAP_INT(nl80211,frequency_offset)
-LUA_WRAP_INT(nl80211,txpower)
-LUA_WRAP_INT(nl80211,txpower_offset)
-LUA_WRAP_INT(nl80211,bitrate)
-LUA_WRAP_INT(nl80211,signal)
-LUA_WRAP_INT(nl80211,noise)
-LUA_WRAP_INT(nl80211,quality)
-LUA_WRAP_INT(nl80211,quality_max)
-LUA_WRAP_STRING(nl80211,ssid)
-LUA_WRAP_STRING(nl80211,bssid)
-LUA_WRAP_STRING(nl80211,country)
-LUA_WRAP_STRING(nl80211,hardware_name)
-LUA_WRAP_STRING(nl80211,phyname)
-LUA_WRAP_STRUCT(nl80211,mode)
-LUA_WRAP_STRUCT(nl80211,assoclist)
-LUA_WRAP_STRUCT(nl80211,txpwrlist)
-LUA_WRAP_STRUCT(nl80211,scanlist)
-LUA_WRAP_STRUCT(nl80211,freqlist)
-LUA_WRAP_STRUCT(nl80211,countrylist)
-LUA_WRAP_STRUCT(nl80211,hwmodelist)
-LUA_WRAP_STRUCT(nl80211,encryption)
-LUA_WRAP_STRUCT(nl80211,mbssid_support)
-LUA_WRAP_STRUCT(nl80211,hardware_id)
+LUA_WRAP_INT_OP(nl80211,channel)
+LUA_WRAP_INT_OP(nl80211,frequency)
+LUA_WRAP_INT_OP(nl80211,frequency_offset)
+LUA_WRAP_INT_OP(nl80211,txpower)
+LUA_WRAP_INT_OP(nl80211,txpower_offset)
+LUA_WRAP_INT_OP(nl80211,bitrate)
+LUA_WRAP_INT_OP(nl80211,signal)
+LUA_WRAP_INT_OP(nl80211,noise)
+LUA_WRAP_INT_OP(nl80211,quality)
+LUA_WRAP_INT_OP(nl80211,quality_max)
+LUA_WRAP_STRING_OP(nl80211,ssid)
+LUA_WRAP_STRING_OP(nl80211,bssid)
+LUA_WRAP_STRING_OP(nl80211,country)
+LUA_WRAP_STRING_OP(nl80211,hardware_name)
+LUA_WRAP_STRING_OP(nl80211,phyname)
+LUA_WRAP_STRUCT_OP(nl80211,mode)
+LUA_WRAP_STRUCT_OP(nl80211,assoclist)
+LUA_WRAP_STRUCT_OP(nl80211,txpwrlist)
+LUA_WRAP_STRUCT_OP(nl80211,scanlist)
+LUA_WRAP_STRUCT_OP(nl80211,freqlist)
+LUA_WRAP_STRUCT_OP(nl80211,countrylist)
+LUA_WRAP_STRUCT_OP(nl80211,hwmodelist)
+LUA_WRAP_STRUCT_OP(nl80211,encryption)
+LUA_WRAP_STRUCT_OP(nl80211,mbssid_support)
+LUA_WRAP_STRUCT_OP(nl80211,hardware_id)
 #endif
 
 /* Wext */