From: Alexandru Hossu <hossu.alexandru@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev
Subject: [PATCH] staging: rtl8723bs: fix OOB write in HT_caps_handler()
Date: Fri, 15 May 2026 03:42:03 -0700 (PDT) [thread overview]
Message-ID: <6a06f87b.669ca06b.fb7de.57d2@mx.google.com> (raw)
Hi Greg,
Here is the fix.
Alexandru
---
The loop in HT_caps_handler() iterates up to pIE->length times, but
HT_cap[] is only 26 bytes. pIE->length comes from the HT Capability IE
in the association response and can be up to 255. This lets a rogue AP
write up to 229 bytes past the array using a bitwise AND into adjacent
struct fields.
Clamp the iteration count to the array size.
Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 4f41f88908d7..e271d1e395a5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -935,7 +935,8 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
pmlmeinfo->HT_caps_enable = 1;
- for (i = 0; i < (pIE->length); i++) {
+ for (i = 0; i < min_t(unsigned int, pIE->length,
+ sizeof(pmlmeinfo->HT_caps.u.HT_cap)); i++) {
if (i != 2) {
/* Commented by Albert 2010/07/12 */
/* Got the endian issue here. */
next reply other threads:[~2026-05-15 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 10:42 Alexandru Hossu [this message]
2026-05-15 10:51 ` [PATCH] staging: rtl8723bs: fix OOB write in HT_caps_handler() Dan Carpenter
2026-05-15 11:35 ` Greg KH
2026-05-15 12:57 ` Alexandru Hossu
2026-05-15 13:01 ` M.samet Duman
2026-05-15 13:12 ` Alexandru Hossu
-- strict thread matches above, loose matches on Subject: below --
2026-04-14 17:19 Greg Kroah-Hartman
2026-04-14 18:39 ` Luka Gejak
2026-04-26 19:27 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a06f87b.669ca06b.fb7de.57d2@mx.google.com \
--to=hossu.alexandru@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox