From: Kalle Valo <kvalo@kernel.org>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 3/4] wifi: hostap: fix stringop-truncations GCC warning
Date: Tue, 13 Jun 2023 17:09:17 +0300 [thread overview]
Message-ID: <20230613140918.389690-4-kvalo@kernel.org> (raw)
In-Reply-To: <20230613140918.389690-1-kvalo@kernel.org>
With GCC 13.1 and W=1 hostap has a warning:
drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3633:17: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
fortify-string.h recommends not to use strncpy() so use strscpy() which fixes
the warning. Also now it's guarenteed that the string is NUL-terminated.
Compile tested only.
Signed-off-by: Kalle Valo <kvalo@kernel.org>
---
drivers/net/wireless/intersil/hostap/hostap_ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c
index 26287b129d18..b4adfc190ae8 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c
@@ -3630,7 +3630,7 @@ static int prism2_ioctl_get_encryption(local_info_t *local,
param->u.crypt.key_len = 0;
param->u.crypt.idx = 0xff;
} else {
- strncpy(param->u.crypt.alg, (*crypt)->ops->name,
+ strscpy(param->u.crypt.alg, (*crypt)->ops->name,
HOSTAP_CRYPT_ALG_NAME_LEN);
param->u.crypt.key_len = 0;
--
2.30.2
next prev parent reply other threads:[~2023-06-13 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 14:09 [PATCH 0/4] wifi: drivers: fix remaining W=1 warnings Kalle Valo
2023-06-13 14:09 ` [PATCH 1/4] wifi: brcmfmac: fix gnu_printf warnings Kalle Valo
2023-06-16 9:26 ` Kalle Valo
2023-06-13 14:09 ` [PATCH 2/4] wifi: brcmsmac: " Kalle Valo
2023-06-13 14:09 ` Kalle Valo [this message]
2023-06-13 14:09 ` [PATCH 4/4] wifi: ray_cs: fix stringop-truncation GCC warning Kalle Valo
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=20230613140918.389690-4-kvalo@kernel.org \
--to=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).