All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mwifiex: Fix possible buffer overflows in mwifiex_config_scan
@ 2020-12-08 12:45 Xiaohui Zhang
  2020-12-08 14:29 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Xiaohui Zhang @ 2020-12-08 12:45 UTC (permalink / raw)
  To: Xiaohui Zhang, Amitkumar Karwar, Ganapathi Bhat, Xinming Hu,
	Kalle Valo, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel

From: Zhang Xiaohui <ruc_zhangxiaohui@163.com>

mwifiex_config_scan() calls memcpy() without checking
the destination size may trigger a buffer overflower,
which a local user could use to cause denial of service
or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index c2a685f63..b1d90678f 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -930,6 +930,8 @@ mwifiex_config_scan(struct mwifiex_private *priv,
 				    "DIRECT-", 7))
 				wildcard_ssid_tlv->max_ssid_length = 0xfe;
 
+			if (ssid_len > 1)
+				ssid_len = 1;
 			memcpy(wildcard_ssid_tlv->ssid,
 			       user_scan_in->ssid_list[i].ssid, ssid_len);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH 1/1] mwifiex: Fix possible buffer overflows in mwifiex_config_scan
@ 2020-12-08 15:09 Xiaohui Zhang
  2020-12-08 19:12 ` Brian Norris
  0 siblings, 1 reply; 8+ messages in thread
From: Xiaohui Zhang @ 2020-12-08 15:09 UTC (permalink / raw)
  To: Xiaohui Zhang, Amitkumar Karwar, Ganapathi Bhat, Xinming Hu,
	Kalle Valo, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel

From: Zhang Xiaohui <ruc_zhangxiaohui@163.com>

mwifiex_config_scan() calls memcpy() without checking
the destination size may trigger a buffer overflower,
which a local user could use to cause denial of service
or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index c2a685f63..34293fd80 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -931,7 +931,7 @@ mwifiex_config_scan(struct mwifiex_private *priv,
 				wildcard_ssid_tlv->max_ssid_length = 0xfe;
 
 			memcpy(wildcard_ssid_tlv->ssid,
-			       user_scan_in->ssid_list[i].ssid, ssid_len);
+			       user_scan_in->ssid_list[i].ssid, min_t(u32, ssid_len, 1));
 
 			tlv_pos += (sizeof(wildcard_ssid_tlv->header)
 				+ le16_to_cpu(wildcard_ssid_tlv->header.len));
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-11 18:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 12:45 [PATCH 1/1] mwifiex: Fix possible buffer overflows in mwifiex_config_scan Xiaohui Zhang
2020-12-08 14:29 ` Kalle Valo
2020-12-09  0:36 ` Julian Calaby
2021-01-09 15:08 ` Peter Seiderer
2021-01-11 18:51   ` Brian Norris
2020-12-08 15:09 Xiaohui Zhang
2020-12-08 19:12 ` Brian Norris
2020-12-17 16:28   ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.