[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230805075114.15186-1-straube.linux@gmail.com>
Date: Sat, 5 Aug 2023 09:51:14 +0200
From: Michael Straube <straube.linux@...il.com>
To: gregkh@...uxfoundation.org
Cc: philipp.g.hortmann@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Michael Straube <straube.linux@...il.com>
Subject: [PATCH] staging: rtl8192e: prefer strscpy over strncpy
Replace strncpy with strscpy in two places where the destination buffer
should be NUL-terminated. Found by checkpatch.
WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90
Signed-off-by: Michael Straube <straube.linux@...il.com>
---
drivers/staging/rtl8192e/rtllib_softmac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 0e52b207942d..bd19d6a2ce41 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1564,7 +1564,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
(!strncmp(ieee->current_network.ssid,
net->hidden_ssid, net->hidden_ssid_len));
if (net->hidden_ssid_len > 0) {
- strncpy(net->ssid, net->hidden_ssid,
+ strscpy(net->ssid, net->hidden_ssid,
net->hidden_ssid_len);
net->ssid_len = net->hidden_ssid_len;
ssidbroad = 1;
@@ -2431,7 +2431,7 @@ static void rtllib_start_master_bss(struct rtllib_device *ieee)
ieee->assoc_id = 1;
if (ieee->current_network.ssid_len == 0) {
- strncpy(ieee->current_network.ssid,
+ strscpy(ieee->current_network.ssid,
RTLLIB_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
--
2.41.0
Powered by blists - more mailing lists