]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check current_ssid on unexpected association event
authorJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 10:32:13 +0000 (13:32 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 10:32:13 +0000 (13:32 +0300)
This is mainly to keep static analyzers silent since it does not look
like this code path can be reached in practice due to the way
association events are handled and current_ssid is either set before
resched here or the association is rejected. Anyway, if this could be
reached, the wpa_supplicant_set_wpa_none_key() call would end up
dereferencing a NULL pointer, so add an explicit check to make sure that
does not happen.

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

index 1ecd6d611463bf784cf9e9a5cbdf1820f3feb156..5482a2598299c23d4bf31221e6ffb113846f9642 100644 (file)
@@ -1956,7 +1956,8 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
            wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE ||
            (wpa_s->current_ssid &&
             wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) {
-               if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE &&
+               if (wpa_s->current_ssid &&
+                   wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE &&
                    (wpa_s->drv_flags &
                     WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) {
                        /*