summaryrefslogtreecommitdiff
path: root/drivers/staging/ks7010
diff options
context:
space:
mode:
authorXu Panda <xu.panda@zte.com.cn>2022-12-26 14:03:24 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-17 21:24:57 +0300
commit7097dc4e5b71cafd653cc2c1ed660f6e8f565480 (patch)
tree5c356f1f90564a85c916321c275f7edeb1b45e63 /drivers/staging/ks7010
parent471213a3776e18caf70aee694358511274e33e9a (diff)
downloadlinux-7097dc4e5b71cafd653cc2c1ed660f6e8f565480.tar.xz
staging: ks7010: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Reviewed-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/202212261903245548969@zte.com.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r--drivers/staging/ks7010/ks_wlan_net.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 044c807ca022..e03c87f0bfe7 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -382,8 +382,7 @@ static int ks_wlan_get_nick(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
- strncpy(extra, priv->nick, 16);
- extra[16] = '\0';
+ strscpy(extra, priv->nick, 17);
dwrq->data.length = strlen(extra) + 1;
return 0;