Re: [PATCH] Staging: rtl8723bs: rtw_wlan_util: Add size check of SSID IE
From: Dan Carpenter
Date: Tue Apr 21 2020 - 14:01:24 EST
On Tue, Apr 21, 2020 at 08:08:06PM +0300, Denis Straghkov wrote:
> /* checking SSID */
> + ssid_len = 0;
> p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
> - if (!p) {
> - DBG_871X("%s marc: cannot find SSID for survey event\n", __func__);
> - hidden_ssid = true;
> - } else {
> - hidden_ssid = false;
> - }
> -
> - if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
> - memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
> - bssid->Ssid.SsidLength = *(p + 1);
> - } else {
> - bssid->Ssid.SsidLength = 0;
> - bssid->Ssid.Ssid[0] = '\0';
> - }
> + if (p) {
> + ssid_len = *(p + 1);
> + if (ssid_len > NDIS_802_11_LENGTH_SSID)
> + ssid_len = 0;
> + }
> + memcpy(bssid->Ssid.Ssid, (p + 2), ssid_len);
> + bssid->Ssid.SsidLength = ssid_len;
This is using spaces instead of tabs. Please run ./scripts/checkpatch.pl
on your patch.
regargs,
dan carpenter