From 4dedd3e69dd6ba7eabee2750f4d8eb78724165a1 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Mon, 16 Oct 2023 16:42:27 +0530 Subject: [PATCH] fix(wifi): Fix static analyzer warning for WPS code --- .../wpa_supplicant/esp_supplicant/src/esp_wps.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c index 90e996d528..de43583afa 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c @@ -1034,15 +1034,18 @@ int wps_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len) tmp = (u8 *)(ehdr + 1) + 1; ret = wps_process_wps_mX_req(tmp, plen - sizeof(*ehdr) - 1, &res); - if (ret == ESP_OK && res != WPS_FAILURE && res != WPS_FRAGMENT) { + if (res == WPS_FRAGMENT) { + wpa_printf(MSG_DEBUG, "wps frag, silently exit", res); + ret = ESP_OK; + break; + } + if (ret == ESP_OK && res != WPS_FAILURE) { ret = wps_send_wps_mX_rsp(ehdr->identifier); + if (ret == ESP_OK) { wpa_printf(MSG_DEBUG, "sm->wps->state = %d", sm->wps->state); wps_start_msg_timer(); } - } else if (ret == ESP_OK && res == WPS_FRAGMENT) { - wpa_printf(MSG_DEBUG, "wps frag, continue..."); - ret = ESP_OK; } else { ret = ESP_FAIL; }