* [PATCH wireless-next] wifi: cfg80211: use strscpy in cfg80211_wext_giwname
@ 2026-05-28 0:10 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-05-28 0:10 UTC (permalink / raw)
To: Johannes Berg; +Cc: Thorsten Blum, linux-wireless, linux-kernel
strcpy() has been deprecated [1] because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows.
While the current code works correctly, replace strcpy() with the safer
strscpy() to follow secure coding best practices.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
net/wireless/wext-compat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 1241fda78a68..1d6c60d3ad5b 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -16,6 +16,7 @@
#include <linux/if_arp.h>
#include <linux/etherdevice.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <net/iw_handler.h>
#include <net/cfg80211.h>
#include <net/cfg80211-wext.h>
@@ -27,7 +28,7 @@ int cfg80211_wext_giwname(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- strcpy(wrqu->name, "IEEE 802.11");
+ strscpy(wrqu->name, "IEEE 802.11");
return 0;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-28 0:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 0:10 [PATCH wireless-next] wifi: cfg80211: use strscpy in cfg80211_wext_giwname Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox