* [PATCH] staging: rtl8188eu: use strlcpy instead of strncpy
@ 2018-07-12 16:16 Michael Straube
0 siblings, 0 replies; only message in thread
From: Michael Straube @ 2018-07-12 16:16 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Use strlcpy instead of strncpy to avoid gcc 8 warning:
warning: '__builtin_strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
The maximum length of the source string including terminating null is 5.
Hence it always fits in the destination buffer of length 16.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 80ccd19e776d..0f82a8c330f8 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1912,7 +1912,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
goto exit;
}
- strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
+ strlcpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
if (pext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
param->u.crypt.set_tx = 1;
--
2.18.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-12 16:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-12 16:16 [PATCH] staging: rtl8188eu: use strlcpy instead of strncpy Michael Straube
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.