nl80211: fix overflow in ssid_len
commit5cabd386ccf73b4a267f8c95e3a0b6e88f297188
authorLuciano Coelho <coelho@ti.com>
Tue, 7 Jun 2011 17:42:26 +0000 (7 20:42 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Nov 2011 20:32:52 +0000 (7 12:32 -0800)
tree9ba662e5c370c80e9d5492250e66a89f4e3e24ec
parent9bb38ae0b3a03b774dd026bf1c7758d2d107f464
nl80211: fix overflow in ssid_len

commit 57a27e1d6a3bb9ad4efeebd3a8c71156d6207536 upstream.

When one of the SSID's length passed in a scan or sched_scan request
is larger than 255, there will be an overflow in the u8 that is used
to store the length before checking.  This causes the check to fail
and we overrun the buffer when copying the SSID.

Fix this by checking the nl80211 attribute length before copying it to
the struct.

This is a follow up for the previous commit
208c72f4fe44fe09577e7975ba0e7fa0278f3d03, which didn't fix the problem
entirely.

Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/wireless/nl80211.c