Commit 87f86cdd authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: wfx: check ssidlen and prevent an array overflow

We need to cap "ssidlen" to prevent a memcpy() overflow.

Fixes: 40115bbc ("staging: wfx: implement the rest of mac80211 API")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200424104235.GA416402@mwandaSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 705b7c36
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment