]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: cw1200: cap SSID length in cw1200_do_join()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 29 Aug 2025 12:48:28 +0000 (15:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:12 +0000 (18:58 +0200)
[ Upstream commit f8f15f6742b8874e59c9c715d0af3474608310ad ]

If the ssidie[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@linaro.org>
Link: https://patch.msgid.link/e91fb43fcedc4893b604dfb973131661510901a7.1756456951.git.dan.carpenter@linaro.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/st/cw1200/sta.c

index c259da8161e4d5ef16ecc2f7a24a469a4af6051b..2bce867dd4acf68cd1911139cd2c3cfee9aefb13 100644 (file)
@@ -1290,7 +1290,7 @@ static void cw1200_do_join(struct cw1200_common *priv)
                rcu_read_lock();
                ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
                if (ssidie) {
-                       join.ssid_len = ssidie[1];
+                       join.ssid_len = min(ssidie[1], IEEE80211_MAX_SSID_LEN);
                        memcpy(join.ssid, &ssidie[2], join.ssid_len);
                }
                rcu_read_unlock();