From 7fae6ce4f2d8aded4bf0510ca8600c09b0c470ba Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Fri, 17 Jun 2022 15:34:25 +0530 Subject: [PATCH] Correct SSID copy length during WPS scan --- components/wpa_supplicant/esp_supplicant/src/esp_wps.c | 4 ++-- components/wpa_supplicant/src/eap_peer/eap_peap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c index 41ddbf1e33..dedf43031d 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c @@ -406,7 +406,7 @@ wps_parse_scan_result(struct wps_scan_ie *scan) wpabuf_free(buf); esp_wifi_enable_sta_privacy_internal(); os_memset(sm->ssid[0], 0, SSID_MAX_LEN); - os_strlcpy((char *)sm->ssid[0], (char *)&scan->ssid[2], (int)scan->ssid[1]); + os_memcpy(sm->ssid[0], (char *)&scan->ssid[2], (int)scan->ssid[1]); sm->ssid_len[0] = scan->ssid[1]; if (scan->bssid && memcmp(sm->bssid, scan->bssid, ETH_ALEN) != 0) { wpa_printf(MSG_INFO, "sm BSSid: "MACSTR " scan BSSID " MACSTR "\n", @@ -1567,7 +1567,7 @@ wifi_wps_scan_done(void *arg, STATUS status) esp_wifi_disconnect(); os_memcpy(wifi_config.sta.bssid, sm->bssid, ETH_ALEN); - os_strlcpy((char *)wifi_config.sta.ssid, (char *)sm->ssid[0], sm->ssid_len[0]); + os_memcpy(wifi_config.sta.ssid, (char *)sm->ssid[0], sm->ssid_len[0]); wifi_config.sta.bssid_set = 1; wpa_printf(MSG_INFO, "WPS: connecting to %s, bssid=" MACSTR, (char *)sm->ssid[0], MAC2STR(wifi_config.sta.bssid)); diff --git a/components/wpa_supplicant/src/eap_peer/eap_peap.c b/components/wpa_supplicant/src/eap_peer/eap_peap.c index 498fb060a2..503ad714df 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_peap.c +++ b/components/wpa_supplicant/src/eap_peer/eap_peap.c @@ -1104,7 +1104,7 @@ static struct wpabuf * eap_peap_process(struct eap_sm *sm, void *priv, } if (tls_connection_established(sm->ssl_ctx, data->ssl.conn)) { - char label[24]; + char label[24] = {0}; wpa_printf(MSG_DEBUG, "EAP-PEAP: TLS done, proceed to Phase 2"); os_free(data->key_data); /* draft-josefsson-ppext-eap-tls-eap-05.txt