]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PASN: Make ssid != NULL check easier for static analyzers
authorJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 09:59:47 +0000 (11:59 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 09:59:47 +0000 (11:59 +0200)
wpas_pasn_sae_setup_pt() would dereference ssid so it cannot be NULL in
the call. That was already taken care of by removing WPA_KEY_MGMT_*SAE*
in the ssid == NULL case. Anyway, adding an explicit check for !ssid
here gets rid of incorrect static analyzer reports.

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

index 5579fe498e131cd5e2fa9ea9712e4a3ea30aba6b..b290e3013e35e9f8a4a36a83bc0862929b56c243 100644 (file)
@@ -251,13 +251,13 @@ static int wpas_pasn_get_params_from_bss(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_SHA384 */
 #endif /* CONFIG_IEEE80211R */
 #ifdef CONFIG_SAE
-       } else if ((sel & WPA_KEY_MGMT_SAE_EXT_KEY) &&
+       } else if ((sel & WPA_KEY_MGMT_SAE_EXT_KEY) && ssid &&
                   (ieee802_11_rsnx_capab(rsnxe,
                                           WLAN_RSNX_CAPAB_SAE_H2E)) &&
                   (wpas_pasn_sae_setup_pt(ssid, group) == 0)) {
                key_mgmt = WPA_KEY_MGMT_SAE_EXT_KEY;
                wpa_printf(MSG_DEBUG, "PASN: using KEY_MGMT SAE (ext key)");
-       } else if ((sel & WPA_KEY_MGMT_SAE) &&
+       } else if ((sel & WPA_KEY_MGMT_SAE) && ssid &&
                   (ieee802_11_rsnx_capab(rsnxe,
                                           WLAN_RSNX_CAPAB_SAE_H2E)) &&
                   (wpas_pasn_sae_setup_pt(ssid, group) == 0)) {