Skip to content

Commit

Permalink
staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()
Browse files Browse the repository at this point in the history
commit 74b6b20 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: 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>
  • Loading branch information
Dan Carpenter authored and gregkh committed Mar 17, 2021
1 parent a311b6a commit da5abe3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
Expand Up @@ -1160,9 +1160,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;
Expand Down

0 comments on commit da5abe3

Please sign in to comment.