mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] staging: rtl8723bs: stop overreading monitor interface name
@ 2026-09-29 15:48 Amirhossein Hajimohammadi
  2026-09-29 16:05 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Amirhossein Hajimohammadi @ 2026-09-29 15:48 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel

From: AmirHossein HajiMohammadi <info@hajimohammadi.net>

cfg80211 passes a NUL-terminated interface name. memcpy() always reads
IFNAMSIZ + 1 bytes, even when the caller supplied a shorter string.

Use strscpy() to stop at the terminator and bound the write to the
destination buffer.

Signed-off-by: AmirHossein HajiMohammadi <info@hajimohammadi.net>
---
Changes in v3:
- Add an explicit From header matching the Signed-off-by identity.

Changes in v2:
- Send the patch inline instead of as a MIME attachment.

 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 4416d0ec1..8f5032844 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -2158,7 +2158,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str
 		goto out;
 
 	*ndev = pwdev_priv->pmon_ndev = mon_ndev;
-	memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ + 1);
+	strscpy(pwdev_priv->ifname_mon, name);
 
 out:
 	if (ret && mon_wdev) {
-- 
2.39.5 (Apple Git-154)


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

end of thread, other threads:[~2026-09-29 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 15:48 [PATCH v3] staging: rtl8723bs: stop overreading monitor interface name Amirhossein Hajimohammadi
2026-09-29 16:05 ` Greg KH
2026-09-29 17:28   ` Amirhossein Hajimohammadi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®