summaryrefslogtreecommitdiff
path: root/drivers/staging/wfx/sta.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-04-24 13:42:35 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-25 12:59:22 +0200
commit87f86cddda65cab8a7e3df8a00e16abeccaa0730 (patch)
tree85f8b23f7f1d9595a45a4189b4f76b73010accbf /drivers/staging/wfx/sta.c
parent705b7c364808de23f067c128afb295e5f0d8da24 (diff)
staging: wfx: check ssidlen and prevent an array overflow
We need to cap "ssidlen" to prevent a memcpy() overflow. Fixes: 40115bbc40e2 ("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>
Diffstat (limited to 'drivers/staging/wfx/sta.c')
-rw-r--r--drivers/staging/wfx/sta.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 5d5c8951f50b..f3e106f7eeac 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -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();