hostapd: Fix segmentation fault when calling hostapd_cli all_sta
While iterating over the stations hostapd_ctrl_iface_sta_mib() might be called with sta == NULL. Fix this. Signed-hostap: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
a6cff8bfa8
commit
a487b35572
1 changed files with 8 additions and 1 deletions
|
@ -86,6 +86,9 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
|
||||||
{
|
{
|
||||||
int len, res, ret, i;
|
int len, res, ret, i;
|
||||||
|
|
||||||
|
if (!sta)
|
||||||
|
return 0;
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
|
ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
|
||||||
MAC2STR(sta->addr));
|
MAC2STR(sta->addr));
|
||||||
|
@ -204,6 +207,10 @@ int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr,
|
||||||
return 0;
|
return 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sta->next)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
|
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue