MLD STA: Fix crash caused by NULL wpa_s->current_ssid

For wpa_supplicant_get_new_bss(), wpa_s->current_ssid can be NULL in
some cases. Add a NULL check before accessing it to avoid NULL pointer
dereference errors.

Fixes: 7784964cbe ("MLD STA: Fetch MLO connection info into core wpa_supplicant")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Qiwei Cai 2022-10-20 13:37:38 +08:00 committed by Jouni Malinen
parent ef5a9a009d
commit 6f3efa21c2

View file

@ -139,7 +139,7 @@ static struct wpa_bss * wpa_supplicant_get_new_bss(
struct wpa_bss *bss = NULL;
struct wpa_ssid *ssid = wpa_s->current_ssid;
if (ssid->ssid_len > 0)
if (ssid && ssid->ssid_len > 0)
bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len);
if (!bss)
bss = wpa_bss_get_bssid(wpa_s, bssid);