This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ae44f9bc wapi: Fix disconnect crash.
5ae44f9bc is described below

commit 5ae44f9bc410b255551ade2d4dc19251c8be99a7
Author: liqinhui <[email protected]>
AuthorDate: Fri Oct 20 09:52:58 2023 +0800

    wapi: Fix disconnect crash.
    
    The ssid string has no terminator, which causes a out of bounds.
    
    Signed-off-by: liqinhui <[email protected]>
---
 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)
         {

Reply via email to