From: Michael Straube <straube.linux@gmail.com>
To: gregkh@linuxfoundation.org
Cc: philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
Michael Straube <straube.linux@gmail.com>
Subject: [PATCH] staging: rtl8192e: prefer strscpy over strncpy
Date: Sat, 5 Aug 2023 09:51:14 +0200 [thread overview]
Message-ID: <20230805075114.15186-1-straube.linux@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2023-08-05 7:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-05 7:51 Michael Straube [this message]
2023-08-09 12:21 ` [PATCH] staging: rtl8192e: prefer strscpy over strncpy Greg KH
2023-08-09 18:02 ` Michael Straube
2023-08-10 5:01 ` Dan Carpenter
2023-08-25 5:13 ` Michael Straube
2023-09-05 9:23 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230805075114.15186-1-straube.linux@gmail.com \
--to=straube.linux@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=philipp.g.hortmann@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.