diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-03-05 11:58:03 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-17 16:07:22 +0100 |
commit | 36f8d0af46daf6eb4c7c5edf6adbfa02e9c70f92 (patch) | |
tree | 7b87d52b6a7800ca8c3907cb93db2af8a7edb129 | |
parent | 6071e18fa6baf76c80c9e498a18703f2b390038c (diff) | |
download | linux-stable-36f8d0af46daf6eb4c7c5edf6adbfa02e9c70f92.tar.gz linux-stable-36f8d0af46daf6eb4c7c5edf6adbfa02e9c70f92.tar.bz2 linux-stable-36f8d0af46daf6eb4c7c5edf6adbfa02e9c70f92.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.c | 6 |
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 2a6192e08b75..c29dc9182470 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -1174,9 +1174,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; |