mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08: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:
committed by
Greg Kroah-Hartman
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;
|
||||
|
||||
Reference in New Issue
Block a user