staging: wfx: check ssidlen and prevent an array overflow
We need to cap "ssidlen" to prevent a memcpy() overflow.
Fixes: 40115bbc40
("staging: wfx: implement the rest of mac80211 API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200424104235.GA416402@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
705b7c3648
commit
87f86cddda
@ -351,7 +351,9 @@ static void wfx_do_join(struct wfx_vif *wvif)
|
||||
ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
|
||||
if (ssidie) {
|
||||
ssidlen = ssidie[1];
|
||||
memcpy(ssid, &ssidie[2], ssidie[1]);
|
||||
if (ssidlen > IEEE80211_MAX_SSID_LEN)
|
||||
ssidlen = IEEE80211_MAX_SSID_LEN;
|
||||
memcpy(ssid, &ssidie[2], ssidlen);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user