From fb958ea76e76f2b682bf9048b07ddb25dd80313e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 7 Jun 2014 13:32:13 +0300 Subject: [PATCH] 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 --- wpa_supplicant/events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) { /* -- 2.47.2