mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
station: Check network_get_psk/passphrase return values
Check the returned values are not NULL.
This commit is contained in:
parent
aef4dd4286
commit
57ce6d0ca5
@ -546,18 +546,30 @@ static struct handshake_state *station_handshake_setup(struct station *station,
|
|||||||
|
|
||||||
if (security == SECURITY_PSK) {
|
if (security == SECURITY_PSK) {
|
||||||
/* SAE will generate/set the PMK */
|
/* SAE will generate/set the PMK */
|
||||||
if (IE_AKM_IS_SAE(hs->akm_suite))
|
if (IE_AKM_IS_SAE(hs->akm_suite)) {
|
||||||
handshake_state_set_passphrase(hs,
|
const char *passphrase =
|
||||||
network_get_passphrase(network));
|
network_get_passphrase(network);
|
||||||
else
|
|
||||||
handshake_state_set_pmk(hs,
|
if (!passphrase)
|
||||||
network_get_psk(network), 32);
|
goto no_psk;
|
||||||
|
|
||||||
|
handshake_state_set_passphrase(hs, passphrase);
|
||||||
|
} else {
|
||||||
|
const uint8_t *psk = network_get_psk(network);
|
||||||
|
|
||||||
|
if (!psk)
|
||||||
|
goto no_psk;
|
||||||
|
|
||||||
|
handshake_state_set_pmk(hs, psk, 32);
|
||||||
|
}
|
||||||
} else if (security == SECURITY_8021X)
|
} else if (security == SECURITY_8021X)
|
||||||
handshake_state_set_8021x_config(hs,
|
handshake_state_set_8021x_config(hs,
|
||||||
network_get_settings(network));
|
network_get_settings(network));
|
||||||
|
|
||||||
return hs;
|
return hs;
|
||||||
|
|
||||||
|
no_psk:
|
||||||
|
l_warn("Missing network PSK/passphrase");
|
||||||
not_supported:
|
not_supported:
|
||||||
handshake_state_free(hs);
|
handshake_state_free(hs);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user