* [PATCH net-next] wifi: atmel: use strscpy() to instead of strncpy()
@ 2022-12-23 2:54 yang.yang29
0 siblings, 0 replies; only message in thread
From: yang.yang29 @ 2022-12-23 2:54 UTC (permalink / raw)
To: simon
Cc: kvalo, davem, edumazet, kuba, pabeni, linux-wireless, netdev,
linux-kernel, xu.panda, yang.yang29
From: Xu Panda <xu.panda@zte.com.cn>
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>
---
drivers/net/wireless/atmel/atmel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index 7c2d1c588156..dda4027c6a31 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -2651,8 +2651,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
priv->firmware = new_firmware;
priv->firmware_length = com.len;
- strncpy(priv->firmware_id, com.id, 31);
- priv->firmware_id[31] = '\0';
+ strscpy(priv->firmware_id, com.id, 32);
break;
case ATMELRD:
--
2.15.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-23 2:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 2:54 [PATCH net-next] wifi: atmel: use strscpy() to instead of strncpy() yang.yang29
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).