Skip to content

Commit f8001e1

Browse files
ahossugregkh
authored andcommitted
staging: rtl8723bs: fix OOB write in HT_caps_handler()
HT_caps_handler() iterates pIE->length bytes and writes into HT_caps.u.HT_cap[], which is a fixed 26-byte array (sizeof struct HT_caps_element). Because pIE->length is a raw u8 from an over-the-air 802.11 AssocResponse frame and is never validated, a malicious AP can set it up to 255, causing up to 229 bytes of out-of-bounds writes into adjacent fields of struct mlme_ext_info. Truncate the iteration count to the size of HT_caps.u.HT_cap using umin() so that data from a longer-than-expected IE is silently ignored rather than written out of bounds, preserving interoperability with APs that pad the element. An early return on oversized IEs was considered but rejected: it would bypass the pmlmeinfo->HT_caps_enable = 1 assignment that precedes the loop, silently disabling HT mode for APs that append extra bytes to the HT Capabilities IE. Fixes: 554c0a3 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable <stable@kernel.org> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com> Reviewed-by: Luka Gejak <luka.gejak@linux.dev> Link: https://patch.msgid.link/20260522004531.1038924-5-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5a752a6 commit f8001e1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/staging/rtl8723bs/core/rtw_wlan_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
909909

910910
pmlmeinfo->HT_caps_enable = 1;
911911

912-
for (i = 0; i < (pIE->length); i++) {
912+
for (i = 0; i < umin(pIE->length,
913+
sizeof(pmlmeinfo->HT_caps.u.HT_cap)); i++) {
913914
if (i != 2) {
914915
/* Commented by Albert 2010/07/12 */
915916
/* Got the endian issue here. */

0 commit comments

Comments
 (0)