From 5ae44f9bc410b255551ade2d4dc19251c8be99a7 Mon Sep 17 00:00:00 2001 From: liqinhui Date: Fri, 20 Oct 2023 09:52:58 +0800 Subject: [PATCH] wapi: Fix disconnect crash. The ssid string has no terminator, which causes a out of bounds. Signed-off-by: liqinhui --- wireless/wapi/src/driver_wext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wireless/wapi/src/driver_wext.c b/wireless/wapi/src/driver_wext.c index fcc688fd5..dc18610fe 100644 --- a/wireless/wapi/src/driver_wext.c +++ b/wireless/wapi/src/driver_wext.c @@ -429,7 +429,7 @@ int wpa_driver_wext_get_auth_param(int sockfd, FAR const char *ifname, void wpa_driver_wext_disconnect(int sockfd, FAR const char *ifname) { - uint8_t ssid[WAPI_ESSID_MAX_SIZE]; + uint8_t ssid[WAPI_ESSID_MAX_SIZE + 1]; const struct ether_addr bssid = { }; @@ -471,6 +471,8 @@ void wpa_driver_wext_disconnect(int sockfd, FAR const char *ifname) ssid[i] = rand() & 0xff; } + ssid[WAPI_ESSID_MAX_SIZE] = '\0'; + if (wapi_set_essid(sockfd, ifname, (FAR const char *)ssid, WAPI_ESSID_OFF) < 0) {