All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()
@ 2021-03-05  8:58 ` Dan Carpenter
  0 siblings, 0 replies; 23+ messages in thread
From: Dan Carpenter @ 2021-03-05  8:58 UTC (permalink / raw)
  To: Larry Finger
  Cc: Greg Kroah-Hartman, Michael Straube, Ivan Safonov,
	Kumar Kartikeya Dwivedi, Takashi Iwai, devel, kernel-janitors

This code has a check to prevent read overflow but it needs another
check to prevent writing beyond the end of the ->ssid[] array.

Fixes: a2c60d42d97c ("staging: r8188eu: Add files for new driver - part 16")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index bf22f130d3e1..58954b88a817 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 						break;
 					}
 					sec_len = *(pos++); len -= 1;
-					if (sec_len > 0 && sec_len <= len) {
+					if (sec_len > 0 &&
+					    sec_len <= len &&
+					    sec_len <= 32) {
 						ssid[ssid_index].ssid_length = sec_len;
-						memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length);
+						memcpy(ssid[ssid_index].ssid, pos, sec_len);
 						ssid_index++;
 					}
 					pos += sec_len;
-- 
2.30.1


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

end of thread, other threads:[~2022-05-26 12:06 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  8:58 [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() Dan Carpenter
2021-03-05  8:58 ` Dan Carpenter
2021-03-05 16:58 ` Edmundo Carmona Antoranz
2021-03-05 16:58   ` Edmundo Carmona Antoranz
2021-03-05 18:32   ` Dan Carpenter
2021-03-05 18:32     ` Dan Carpenter
2021-03-05 18:55     ` Edmundo Carmona Antoranz
2021-03-05 18:55       ` Edmundo Carmona Antoranz
2022-05-18  7:00 ` [PATCH] staging: r8188eu: prevent ->Ssid " Denis Efremov
2022-05-18  7:49   ` Denis Efremov
2022-05-19 15:40     ` Greg KH
2022-05-20  3:57       ` [PATCH v5.10] staging: rtl8723bs: " Denis Efremov (Oracle)
2022-05-23 15:26         ` Greg KH
2022-05-23 17:41           ` Denis Efremov
2022-05-26 12:05             ` Greg KH
2022-05-26 12:05         ` Patch "staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()" has been added to the 5.10-stable tree gregkh
2022-05-23 17:39       ` [PATCH v5.4-v4.14] staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan() Denis Efremov (Oracle)
2022-05-26 12:05         ` Patch "staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()" has been added to the 4.14-stable tree gregkh
2022-05-26 12:05         ` Patch "staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()" has been added to the 4.19-stable tree gregkh
2022-05-26 12:05         ` Patch "staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()" has been added to the 5.4-stable tree gregkh
2022-05-19 15:45   ` [PATCH] staging: r8188eu: prevent ->Ssid overflow in rtw_wx_set_scan() Greg KH
2022-05-19 17:16     ` Dan Carpenter
2022-05-19 17:36       ` Greg KH

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.