mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
Replace all strncpy with strlcpy for safety
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
+2
-2
@@ -1009,7 +1009,7 @@ static int tun_dev_init(FAR struct tun_device_s *priv,
|
||||
|
||||
if (devfmt)
|
||||
{
|
||||
strncpy(priv->dev.d_ifname, devfmt, IFNAMSIZ);
|
||||
strlcpy(priv->dev.d_ifname, devfmt, IFNAMSIZ);
|
||||
}
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
@@ -1342,7 +1342,7 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
tun->free_tuns &= ~(1 << intf);
|
||||
|
||||
priv = filep->f_priv;
|
||||
strncpy(ifr->ifr_name, priv->dev.d_ifname, IFNAMSIZ);
|
||||
strlcpy(ifr->ifr_name, priv->dev.d_ifname, IFNAMSIZ);
|
||||
tundev_unlock(tun);
|
||||
|
||||
return OK;
|
||||
|
||||
Reference in New Issue
Block a user