Skip to contentSkip to conversation

patch "staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()" added to staging-linus

PATCH [email protected] 1 participant 1 message Mar 9, 2021

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 8de2af767b55dc4512a804837f5e42170ac12adc Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Fri, 5 Mar 2021 11:58:03 +0300
Subject: staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()

This code has a check to prevent read overflow but it needs another check to prevent writing beyond the end of the ->ssid[] array.

Fixes a2c60d42d97c ("staging: r8188eu: Add files for new driver - part 16")
Cc stable <[email protected]>
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +4 -2
index bf22f130d3e1..58954b88a817 100644
@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 						break;
 					}
 					sec_len = *(pos++); len -= 1;
-					if (sec_len > 0 && sec_len <= len) {
+					if (sec_len > 0 &&
+					    sec_len <= len &&
+					    sec_len <= 32) {
 						ssid[ssid_index].ssid_length = sec_len;
-						memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length);
+						memcpy(ssid[ssid_index].ssid, pos, sec_len);
 						ssid_index++;
 					}
 					pos += sec_len;
Signature · 1 line
2.30.1