mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +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) {
|
||||
/* SAE will generate/set the PMK */
|
||||
if (IE_AKM_IS_SAE(hs->akm_suite))
|
||||
handshake_state_set_passphrase(hs,
|
||||
network_get_passphrase(network));
|
||||
else
|
||||
handshake_state_set_pmk(hs,
|
||||
network_get_psk(network), 32);
|
||||
if (IE_AKM_IS_SAE(hs->akm_suite)) {
|
||||
const char *passphrase =
|
||||
network_get_passphrase(network);
|
||||
|
||||
if (!passphrase)
|
||||
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)
|
||||
handshake_state_set_8021x_config(hs,
|
||||
network_get_settings(network));
|
||||
|
||||
return hs;
|
||||
|
||||
no_psk:
|
||||
l_warn("Missing network PSK/passphrase");
|
||||
not_supported:
|
||||
handshake_state_free(hs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user