Clear PSK explicitly from memory in couple more cases on deinit
Couple of the WPS/P2P/RADIUS-PSK cases were freeing heap memory allocations without explicitly clearing the PSK value. Add such clearing for these to avoid leaving the PSK in memory after it is not needed anymore. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
567b9764fb
commit
738fef2f0b
3 changed files with 4 additions and 3 deletions
|
@ -646,6 +646,6 @@ void hostapd_free_psk_list(struct hostapd_sta_wpa_psk_short *psk)
|
||||||
while (psk) {
|
while (psk) {
|
||||||
struct hostapd_sta_wpa_psk_short *prev = psk;
|
struct hostapd_sta_wpa_psk_short *prev = psk;
|
||||||
psk = psk->next;
|
psk = psk->next;
|
||||||
os_free(prev);
|
bin_clear_free(prev, sizeof(*prev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1069,10 +1069,11 @@ static void hostapd_free_wps(struct wps_context *wps)
|
||||||
for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
|
for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
|
||||||
wpabuf_free(wps->dev.vendor_ext[i]);
|
wpabuf_free(wps->dev.vendor_ext[i]);
|
||||||
wps_device_data_free(&wps->dev);
|
wps_device_data_free(&wps->dev);
|
||||||
os_free(wps->network_key);
|
bin_clear_free(wps->network_key, wps->network_key_len);
|
||||||
hostapd_wps_nfc_clear(wps);
|
hostapd_wps_nfc_clear(wps);
|
||||||
wpabuf_free(wps->dh_pubkey);
|
wpabuf_free(wps->dh_pubkey);
|
||||||
wpabuf_free(wps->dh_privkey);
|
wpabuf_free(wps->dh_privkey);
|
||||||
|
forced_memzero(wps->psk, sizeof(wps->psk));
|
||||||
os_free(wps);
|
os_free(wps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8825,7 +8825,7 @@ static void wpas_p2p_remove_client_go(struct wpa_supplicant *wpa_s,
|
||||||
hapd->conf->ssid.wpa_psk = psk->next;
|
hapd->conf->ssid.wpa_psk = psk->next;
|
||||||
rem = psk;
|
rem = psk;
|
||||||
psk = psk->next;
|
psk = psk->next;
|
||||||
os_free(rem);
|
bin_clear_free(rem, sizeof(*rem));
|
||||||
} else {
|
} else {
|
||||||
prev = psk;
|
prev = psk;
|
||||||
psk = psk->next;
|
psk = psk->next;
|
||||||
|
|
Loading…
Reference in a new issue