[PATCH] staging: rtl8188eu: Fix off-by-one in core/rtw_mlme_ext.c

Yang Xiao YangX92 at hotmail.com
Tue Nov 27 07:29:07 UTC 2018


From: Young_X <YangX92 at hotmail.com>

    The error at line 3267 was the result of an off-by-one error in
    a for loop in line 3253.
    If condition in line 3254 never satisfies, then the value of
    pstat->aid is NUM_STA+1. This will lead to out-of-bound access
    in line 3267.

Signed-off-by: Young_X <YangX92 at hotmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 6790b840..0854adc 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -3250,7 +3250,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
 	if (pstat->aid > 0) {
 		DBG_88E("  old AID %d\n", pstat->aid);
 	} else {
-		for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++)
+		for (pstat->aid = 1; pstat->aid < NUM_STA; pstat->aid++)
 			if (pstapriv->sta_aid[pstat->aid - 1] == NULL)
 				break;
 
-- 
2.7.4



More information about the devel mailing list