summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-03-05 11:58:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 16:43:49 +0100
commiteda4378094de16090d74eacea3d8c10f7719ed25 (patch)
tree10e3bb3b0f04317596a52da9a7ff0e80d6bdfc65
parent2b7a58254b73503ad404e615c50de7c728219ca8 (diff)
downloadlinux-stable-eda4378094de16090d74eacea3d8c10f7719ed25.tar.gz
linux-stable-eda4378094de16090d74eacea3d8c10f7719ed25.tar.bz2
linux-stable-eda4378094de16090d74eacea3d8c10f7719ed25.zip
staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()
commit 74b6b20df8cfe90ada777d621b54c32e69e27cd7 upstream. 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") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/YEHymwsnHewzoam7@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8188eu/os_dep/ioctl_linux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 0003f0c38038..2e1f31b08e8b 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1161,9 +1161,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].SsidLength = sec_len;
- memcpy(ssid[ssid_index].Ssid, pos, ssid[ssid_index].SsidLength);
+ memcpy(ssid[ssid_index].Ssid, pos, sec_len);
ssid_index++;
}
pos += sec_len;