Skip to contentSkip to conversation

staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data()

PATCH New Dan Carpenter 1 participant 1 message Apr 22, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data()

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")
drivers/staging/rtl8188eu/core/rtw_ap.c +1 -1
index 91156a21b8f2..519b4d3584a2 100644
@@ -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;