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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-06-07 13:32:13 +03:00
parent f5fa824e9a
commit fb958ea76e

View 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->key_mgmt == WPA_KEY_MGMT_WPA_NONE ||
(wpa_s->current_ssid && (wpa_s->current_ssid &&
wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) { 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_s->drv_flags &
WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) { WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) {
/* /*