From c18b6668eb34e7f11ffb7812cef2f3f5d0775a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bremv=C3=A5g?= Date: Fri, 16 Aug 2019 23:05:40 +0200 Subject: [PATCH] staging: prevent an underflow in rtw_check_beacon_data() * The "len" could be as low as -14 so we should check for negatives. --- core/rtw_ap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 6d41be8..374082a 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -1931,8 +1931,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) if (!MLME_IS_AP(padapter) && !MLME_IS_MESH(padapter)) return _FAIL; - - if (len > MAX_IE_SZ) + if (len < 0 || len > MAX_IE_SZ) return _FAIL; pbss_network->IELength = len;