From: Jouni Malinen Date: Sat, 7 Jun 2014 10:32:13 +0000 (+0300) Subject: Check current_ssid on unexpected association event X-Git-Tag: hostap_2_3~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb958ea76e76f2b682bf9048b07ddb25dd80313e;p=thirdparty%2Fhostap.git Check current_ssid on unexpected association event 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 --- diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 1ecd6d611..5482a2598 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -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)) { /*