staging: wilc1000: Increase the size of wid_list array
authorOscar Carter <oscar.carter@gmx.com>
Mon, 4 May 2020 15:09:11 +0000 (17:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 May 2020 10:23:28 +0000 (12:23 +0200)
Increase by one the size of wid_list array as index variable can reach a
value of 5. If this happens, an out-of-bounds access is performed.

Also, use a #define instead of a hard-coded literal for the new array
size.

Addresses-Coverity-ID: 1451981 ("Out-of-bounds access")
Fixes: f5a3cb90b802d ("staging: wilc1000: add passive scan support")
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200504150911.4470-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/hif.c

index 6c7de2f..d025a30 100644 (file)
@@ -11,6 +11,8 @@
 
 #define WILC_FALSE_FRMWR_CHANNEL               100
 
+#define WILC_SCAN_WID_LIST_SIZE                6
+
 struct wilc_rcvd_mac_info {
        u8 status;
 };
@@ -151,7 +153,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
              void *user_arg, struct cfg80211_scan_request *request)
 {
        int result = 0;
-       struct wid wid_list[5];
+       struct wid wid_list[WILC_SCAN_WID_LIST_SIZE];
        u32 index = 0;
        u32 i, scan_timeout;
        u8 *buffer;