mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 02:17:37 +08:00
netutils/netlib: Fix error: 'strncpy' specified bound 16 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:

committed by
Petro Karashchenko

parent
f31cc67da8
commit
3afd1234e0
@@ -230,8 +230,8 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
|
||||
|
||||
devlist[ncopied].ifindex = iface->ifi_index;
|
||||
#endif
|
||||
strncpy(devlist[ncopied].ifname,
|
||||
(FAR char *)RTA_DATA(attr), IFNAMSIZ);
|
||||
strlcpy(devlist[ncopied].ifname,
|
||||
(FAR char *)RTA_DATA(attr), IFNAMSIZ);
|
||||
ncopied++;
|
||||
}
|
||||
|
||||
|
@@ -72,7 +72,7 @@ int netlib_getnodnodeaddr(FAR const char *ifname,
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
||||
strncpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
strlcpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
|
||||
/* And perform the IOCTL command */
|
||||
|
||||
|
@@ -72,7 +72,7 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
|
||||
{
|
||||
/* Perform the IOCTL */
|
||||
|
||||
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||
strlcpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||
arg.u.getreq.attr = IEEE802154_ATTR_MAC_PANID;
|
||||
|
||||
ret = ioctl(sockfd, MAC802154IOC_MLME_GET_REQUEST,
|
||||
|
@@ -72,7 +72,7 @@ int netlib_getproperties(FAR const char *ifname,
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
||||
strncpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
strlcpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
|
||||
/* And perform the IOCTL command */
|
||||
|
||||
|
@@ -165,7 +165,7 @@ static int _netlib_ipv6adaptor(FAR const struct in6_addr *destipaddr,
|
||||
|
||||
/* Get the network mask */
|
||||
|
||||
strncpy(maskreq.lifr_name, lifr->lifr_name, IFNAMSIZ);
|
||||
strlcpy(maskreq.lifr_name, lifr->lifr_name, IFNAMSIZ);
|
||||
|
||||
status = ioctl(sd, SIOCGLIFNETMASK,
|
||||
(unsigned long)((uintptr_t)&maskreq));
|
||||
|
@@ -72,7 +72,7 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
|
||||
{
|
||||
/* Perform the IOCTL */
|
||||
|
||||
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||
strlcpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||
arg.u.setreq.attr = IEEE802154_ATTR_MAC_EADDR;
|
||||
IEEE802154_EADDRCOPY(arg.u.setreq.attrval.mac.eaddr, eaddr);
|
||||
|
||||
|
@@ -72,7 +72,7 @@ int netlib_setnodeaddr(FAR const char *ifname,
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
||||
strncpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
strlcpy(req.pifr_name, ifname, IFNAMSIZ);
|
||||
|
||||
/* Copy the node address into the request */
|
||||
|
||||
|
Reference in New Issue
Block a user