]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Check wpa_s->current_bss more consistently
authorJouni Malinen <j@w1.fi>
Sun, 2 Mar 2014 13:21:59 +0000 (15:21 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 2 Mar 2014 15:15:12 +0000 (17:15 +0200)
The scan result comparison routine would not make much sense without
current BSS level known, so return from the function without going
through the iteration that could have dereferenced the pointer if
wpa_s->current_bss == NULL.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/wnm_sta.c

index 0619f6db3753df201c5cfc253722854b395a1a8a..7db6eb69ad0fffa77b959d686d4fca8eac9cfff8 100644 (file)
@@ -471,12 +471,11 @@ static int compare_scan_neighbor_results(struct wpa_supplicant *wpa_s,
 
        u8 i, j;
 
-       if (scan_res == NULL || num_neigh_rep == 0)
+       if (scan_res == NULL || num_neigh_rep == 0 || !wpa_s->current_bss)
                return 0;
 
        wpa_printf(MSG_DEBUG, "WNM: Current BSS " MACSTR " RSSI %d",
-                  MAC2STR(wpa_s->bssid),
-                  wpa_s->current_bss ? wpa_s->current_bss->level : 0);
+                  MAC2STR(wpa_s->bssid), wpa_s->current_bss->level);
 
        for (i = 0; i < num_neigh_rep; i++) {
                for (j = 0; j < scan_res->num; j++) {