Skip to content

Commit 74b6b20

Browse files
Dan Carpentergregkh
authored andcommitted
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: a2c60d4 ("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>
1 parent d4ac640 commit 74b6b20

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/staging/rtl8188eu/os_dep/ioctl_linux.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
11331133
break;
11341134
}
11351135
sec_len = *(pos++); len -= 1;
1136-
if (sec_len > 0 && sec_len <= len) {
1136+
if (sec_len > 0 &&
1137+
sec_len <= len &&
1138+
sec_len <= 32) {
11371139
ssid[ssid_index].ssid_length = sec_len;
1138-
memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length);
1140+
memcpy(ssid[ssid_index].ssid, pos, sec_len);
11391141
ssid_index++;
11401142
}
11411143
pos += sec_len;

0 commit comments

Comments
 (0)