mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 06:43:09 +00:00
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>
This commit is contained in:
parent
471213a377
commit
7097dc4e5b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user