Skip to content

Commit b6bde71

Browse files
Dan Carpenteropsiff
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> (cherry picked from commit 609f6debdff3f922cbf7ea146b1d1994e12f928b)
1 parent cca6e1d commit b6bde71

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • drivers/net/wireless/marvell/libertas

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

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

11591162
/* add DS param TLV */

0 commit comments

Comments
 (0)