dbus: Check that wpa_s->scan_res != NULL before dereferencing it

This commit is contained in:
Jouni Malinen 2009-12-26 13:55:22 +02:00
parent 2ee055b3c0
commit 376900708a
2 changed files with 3 additions and 3 deletions

View File

@ -1640,7 +1640,7 @@ static int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
return 0;
/* unregister all BSSs and networks from dbus */
for (i = 0; i < wpa_s->scan_res->num; i++) {
for (i = 0; wpa_s->scan_res && i < wpa_s->scan_res->num; i++) {
wpas_dbus_unregister_bss(wpa_s,
wpa_s->scan_res->res[i]->bssid);
}

View File

@ -188,7 +188,7 @@ static struct wpa_scan_res * find_scan_result(struct bss_handler_args *bss)
{
struct wpa_scan_results *results = bss->wpa_s->scan_res;
size_t i;
for (i = 0; i < results->num; i++) {
for (i = 0; results && i < results->num; i++) {
if (!os_memcmp(results->res[i]->bssid, bss->bssid, ETH_ALEN))
return results->res[i];
}
@ -2287,7 +2287,7 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
if (!is_zero_ether_addr(wpa_s->bssid)) {
size_t i;
for (i = 0; i < wpa_s->scan_res->num; i++) {
for (i = 0; wpa_s->scan_res && i < wpa_s->scan_res->num; i++) {
struct wpa_scan_res *res = wpa_s->scan_res->res[i];
if (!os_memcmp(wpa_s->bssid, res->bssid, ETH_ALEN)) {
is_bssid_known = 1;