[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a40f5ec7617144aef412034c12919a4927d90ad.1756456951.git.dan.carpenter@linaro.org>
Date: Fri, 29 Aug 2025 15:48:35 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Solomon Peachy <pizza@...ftnet.org>
Cc: Johannes Berg <johannes.berg@...el.com>, Felix Fietkau <nbd@....name>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Al Viro <viro@...iv.linux.org.uk>,
"John W. Linville" <linville@...driver.com>,
linux-wireless@...r.kernel.org, libertas-dev@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] wifi: libertas: cap SSID len in lbs_associate()
If the ssid_eid[1] length is more that 32 it leads to memory corruption.
Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/net/wireless/marvell/libertas/cfg.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
index 94dd488becaf..caba7491cd5a 100644
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
@@ -1151,10 +1151,13 @@ static int lbs_associate(struct lbs_private *priv,
/* add SSID TLV */
rcu_read_lock();
ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
- if (ssid_eid)
- pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_eid[1]);
- else
+ if (ssid_eid) {
+ u32 ssid_len = min(ssid_eid[1], IEEE80211_MAX_SSID_LEN);
+
+ pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_len);
+ } else {
lbs_deb_assoc("no SSID\n");
+ }
rcu_read_unlock();
/* add DS param TLV */
--
2.47.2
Powered by blists - more mailing lists