summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorNavaneeth K <knavaneeth786@gmail.com>2025-11-20 16:33:08 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-12 18:37:21 +0100
commit61871c83259a511980ec2664964cecc69005398b (patch)
tree16c095b71faa4375f8e8640e7f810c1aecc90132 /drivers/staging
parenta54e2b2db1b7de2e008b4f62eec35aaefcc663c5 (diff)
downloadlinux-61871c83259a511980ec2664964cecc69005398b.tar.gz
linux-61871c83259a511980ec2664964cecc69005398b.tar.bz2
linux-61871c83259a511980ec2664964cecc69005398b.zip
staging: rtl8723bs: fix stack buffer overflow in OnAssocReq IE parsing
commit 6ef0e1c10455927867cac8f0ed6b49f328f8cf95 upstream. The Supported Rates IE length from an incoming Association Request frame was used directly as the memcpy() length when copying into a fixed-size 16-byte stack buffer (supportRate). A malicious station can advertise an IE length larger than 16 bytes, causing a stack buffer overflow. Clamp ie_len to the buffer size before copying the Supported Rates IE, and correct the bounds check when merging Extended Supported Rates to prevent a second potential overflow. This prevents kernel stack corruption triggered by malformed association requests. Signed-off-by: Navaneeth K <knavaneeth786@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_mlme_ext.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 4d4bec47d187..c51e7e551300 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1033,6 +1033,9 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
status = WLAN_STATUS_CHALLENGE_FAIL;
goto OnAssocReqFail;
} else {
+ if (ie_len > sizeof(supportRate))
+ ie_len = sizeof(supportRate);
+
memcpy(supportRate, p+2, ie_len);
supportRateNum = ie_len;
@@ -1040,7 +1043,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
pkt_len - WLAN_HDR_A3_LEN - ie_offset);
if (p) {
- if (supportRateNum <= sizeof(supportRate)) {
+ if (supportRateNum + ie_len <= sizeof(supportRate)) {
memcpy(supportRate+supportRateNum, p+2, ie_len);
supportRateNum += ie_len;
}