78db26870bdb90928d1f150e994b037302a74031
[openwrt/staging/stintel.git] /
1 From 1b5e2423164b3670e8bc9174e4762d297990deff Mon Sep 17 00:00:00 2001
2 From: Arend van Spriel <arend.vanspriel@broadcom.com>
3 Date: Thu, 14 Feb 2019 13:43:47 +0100
4 Subject: [PATCH] brcmfmac: assure SSID length from firmware is limited
5
6 The SSID length as received from firmware should not exceed
7 IEEE80211_MAX_SSID_LEN as that would result in heap overflow.
8
9 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
10 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
11 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
12 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
14 ---
15 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++
16 1 file changed, 2 insertions(+)
17
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 @@ -3499,6 +3499,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
21 }
22
23 netinfo = brcmf_get_netinfo_array(pfn_result);
24 + if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN)
25 + netinfo->SSID_len = IEEE80211_MAX_SSID_LEN;
26 memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len);
27 cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len;
28 cfg->wowl.nd->n_channels = 1;