]> 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 17:02:25 +0000 (19:02 +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 5dd7f6a389006db4f15ec8c2b757ee9b5487e12d..cc56018b2e32746679f6c08405912c3ea8ca272d 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();