mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
net:fix coverity warning
Signed-off-by: hejianliang3 <hejianliang3@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
451c53daa4
commit
e9648d8a73
@@ -122,7 +122,7 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg)
|
||||
* transferred is returned in ifc_len.
|
||||
*/
|
||||
|
||||
strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
|
||||
strlcpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
|
||||
|
||||
inaddr->sin_family = AF_INET;
|
||||
inaddr->sin_port = 0;
|
||||
|
||||
@@ -1086,7 +1086,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
dev = netdev_findbyindex(req->ifr_ifindex);
|
||||
if (dev != NULL)
|
||||
{
|
||||
strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
|
||||
strlcpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -399,7 +399,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
*/
|
||||
|
||||
dev->d_ifname[IFNAMSIZ - 1] = '\0';
|
||||
strncpy(devfmt_str, dev->d_ifname, IFNAMSIZ);
|
||||
strlcpy(devfmt_str, dev->d_ifname, IFNAMSIZ);
|
||||
|
||||
/* Then use the content of the temporary buffer as the format
|
||||
* string.
|
||||
|
||||
Reference in New Issue
Block a user