staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 22 Apr 2017 10:47:23 +0000 (13:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Apr 2017 10:30:20 +0000 (12:30 +0200)
The "len" could be as low as -14 so we should check for negatives.

Fixes: 9a7fe54ddc3a ("staging: r8188eu: Add source files for new driver - part 1")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_ap.c

index 91156a21b8f2e181e879567b57255260892378c0..519b4d3584a27722db7f5a8f3be1f0bfeccf1fe7 100644 (file)
@@ -878,7 +878,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
                return _FAIL;
 
 
-       if (len > MAX_IE_SZ)
+       if (len < 0 || len > MAX_IE_SZ)
                return _FAIL;
 
        pbss_network->IELength = len;