Skip to content

Commit d7d9897

Browse files
Dan Carpentergregkh
authored andcommitted
wifi: libertas: cap SSID len in lbs_associate()
[ Upstream commit c786794 ] If the ssid_eid[1] length is more that 32 it leads to memory corruption. Fixes: a910e4a ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/2a40f5ec7617144aef412034c12919a4927d90ad.1756456951.git.dan.carpenter@linaro.org Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a7b20f5 commit d7d9897

File tree

1 file changed

+6
-3
lines changed
  • drivers/net/wireless/marvell/libertas

1 file changed

+6
-3
lines changed

drivers/net/wireless/marvell/libertas/cfg.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,10 +1151,13 @@ static int lbs_associate(struct lbs_private *priv,
11511151
/* add SSID TLV */
11521152
rcu_read_lock();
11531153
ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
1154-
if (ssid_eid)
1155-
pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_eid[1]);
1156-
else
1154+
if (ssid_eid) {
1155+
u32 ssid_len = min(ssid_eid[1], IEEE80211_MAX_SSID_LEN);
1156+
1157+
pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_len);
1158+
} else {
11571159
lbs_deb_assoc("no SSID\n");
1160+
}
11581161
rcu_read_unlock();
11591162

11601163
/* add DS param TLV */

0 commit comments

Comments
 (0)