mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-29 18:27:20 +02:00
fix(wpa_supplicant): Fix some coverity issues in wpa_supplicant
1. Fix leak in SoftAP while sending SAE Confirm 2. Move NULL check before pointer is getting used 3. Remove some dead code
This commit is contained in:
committed by
Shreyas Sheth
parent
9795558c03
commit
2d913cbd01
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -1151,6 +1151,10 @@ struct wpabuf * crypto_ecdh_set_peerkey(struct crypto_ecdh *ecdh, int inc_y,
|
||||
int secret_key = 0;
|
||||
|
||||
mbedtls_ecdh_context *ctx = (mbedtls_ecdh_context *)ecdh;
|
||||
if (!ctx) {
|
||||
wpa_printf(MSG_ERROR, "ECDH Context is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
mbedtls_entropy_context entropy;
|
||||
@ -1205,7 +1209,7 @@ struct wpabuf * crypto_ecdh_set_peerkey(struct crypto_ecdh *ecdh, int inc_y,
|
||||
|
||||
/* Setup ECDH context from EC key */
|
||||
/* Call to mbedtls_ecdh_get_params() will initialize the context when not LEGACY context */
|
||||
if (ctx != NULL && peer != NULL) {
|
||||
if (peer != NULL) {
|
||||
mbedtls_ecp_copy( ACCESS_ECDH(&ctx, Qp), &(mbedtls_pk_ec(*peer))->MBEDTLS_PRIVATE(Q) );
|
||||
#ifndef CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT
|
||||
ctx->MBEDTLS_PRIVATE(var) = MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0;
|
||||
|
@ -178,6 +178,7 @@ static int auth_sae_send_confirm(struct hostapd_data *hapd,
|
||||
#ifdef ESP_SUPPLICANT
|
||||
if (sta->remove_pending) {
|
||||
reply_res = -1;
|
||||
wpabuf_free(data);
|
||||
} else {
|
||||
if (sta->sae_data)
|
||||
wpabuf_free(sta->sae_data);
|
||||
|
@ -2718,8 +2718,6 @@ struct wpa_sm * get_wpa_sm(void)
|
||||
int wpa_sm_set_ap_rsnxe(const u8 *ie, size_t len)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
if (!sm)
|
||||
return -1;
|
||||
|
||||
os_free(sm->ap_rsnxe);
|
||||
if (!ie || len == 0) {
|
||||
|
Reference in New Issue
Block a user