diff --git a/netutils/netlib/netlib_autoconfig.c b/netutils/netlib/netlib_autoconfig.c index d094a8237..56f169de7 100644 --- a/netutils/netlib/netlib_autoconfig.c +++ b/netutils/netlib/netlib_autoconfig.c @@ -71,7 +71,7 @@ int netlib_icmpv6_autoconfiguration(FAR const char *ifname) /* Create a request consisting only of the interface name */ struct lifreq req; - strncpy(req.lifr_name, ifname, IFNAMSIZ); + strlcpy(req.lifr_name, ifname, IFNAMSIZ); /* Perform the ICMPv6 auto-configuration and close the socket */ diff --git a/netutils/netlib/netlib_getdripv4addr.c b/netutils/netlib/netlib_getdripv4addr.c index efafd6c8b..32398baa9 100644 --- a/netutils/netlib/netlib_getdripv4addr.c +++ b/netutils/netlib/netlib_getdripv4addr.c @@ -70,7 +70,7 @@ int netlib_get_dripv4addr(FAR const char *ifname, FAR struct in_addr *addr) if (sockfd >= 0) { struct ifreq req; - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); ret = ioctl(sockfd, SIOCGIFDSTADDR, (unsigned long)&req); if (!ret) { diff --git a/netutils/netlib/netlib_getessid.c b/netutils/netlib/netlib_getessid.c index baa59d39d..6204c1745 100644 --- a/netutils/netlib/netlib_getessid.c +++ b/netutils/netlib/netlib_getessid.c @@ -77,7 +77,7 @@ int netlib_getessid(FAR const char *ifname, FAR char *essid, size_t idlen) /* Put the driver name into the request */ memset(&req, 0, sizeof(struct iwreq)); - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Put pointer to receive the ESSID into the request */ diff --git a/netutils/netlib/netlib_getifstatus.c b/netutils/netlib/netlib_getifstatus.c index e4688af35..0105a1621 100644 --- a/netutils/netlib/netlib_getifstatus.c +++ b/netutils/netlib/netlib_getifstatus.c @@ -73,7 +73,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Perform the ioctl to ifup or ifdown status */ diff --git a/netutils/netlib/netlib_getipv4addr.c b/netutils/netlib/netlib_getipv4addr.c index 3253808b2..56a61853a 100644 --- a/netutils/netlib/netlib_getipv4addr.c +++ b/netutils/netlib/netlib_getipv4addr.c @@ -70,7 +70,7 @@ int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr) if (sockfd >= 0) { struct ifreq req; - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); ret = ioctl(sockfd, SIOCGIFADDR, (unsigned long)&req); if (!ret) { diff --git a/netutils/netlib/netlib_getipv4netmask.c b/netutils/netlib/netlib_getipv4netmask.c index 3c8e66e25..a341774b1 100644 --- a/netutils/netlib/netlib_getipv4netmask.c +++ b/netutils/netlib/netlib_getipv4netmask.c @@ -70,7 +70,7 @@ int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr) if (sockfd >= 0) { struct ifreq req; - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); ret = ioctl(sockfd, SIOCGIFNETMASK, (unsigned long)&req); if (!ret) { diff --git a/netutils/netlib/netlib_getipv6addr.c b/netutils/netlib/netlib_getipv6addr.c index 8c38e99ca..1260e1f09 100644 --- a/netutils/netlib/netlib_getipv6addr.c +++ b/netutils/netlib/netlib_getipv6addr.c @@ -71,7 +71,7 @@ int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr) { struct lifreq req; - strncpy(req.lifr_name, ifname, IFNAMSIZ); + strlcpy(req.lifr_name, ifname, IFNAMSIZ); ret = ioctl(sockfd, SIOCGLIFADDR, (unsigned long)&req); if (!ret) { diff --git a/netutils/netlib/netlib_getmacaddr.c b/netutils/netlib/netlib_getmacaddr.c index 387aa7c85..46b799be3 100644 --- a/netutils/netlib/netlib_getmacaddr.c +++ b/netutils/netlib/netlib_getmacaddr.c @@ -72,7 +72,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Perform the ioctl to get the MAC address */ diff --git a/netutils/netlib/netlib_setdripv4addr.c b/netutils/netlib/netlib_setdripv4addr.c index c1e37d5f1..f04dba417 100644 --- a/netutils/netlib/netlib_setdripv4addr.c +++ b/netutils/netlib/netlib_setdripv4addr.c @@ -90,7 +90,7 @@ int netlib_set_dripv4addr(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setdripv6addr.c b/netutils/netlib/netlib_setdripv6addr.c index 947b1ff04..4da663e6c 100644 --- a/netutils/netlib/netlib_setdripv6addr.c +++ b/netutils/netlib/netlib_setdripv6addr.c @@ -71,7 +71,7 @@ int netlib_set_dripv6addr(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.lifr_name, ifname, IFNAMSIZ); + strlcpy(req.lifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setessid.c b/netutils/netlib/netlib_setessid.c index 8f49d375c..ab91d09bf 100644 --- a/netutils/netlib/netlib_setessid.c +++ b/netutils/netlib/netlib_setessid.c @@ -75,7 +75,7 @@ int netlib_setessid(FAR const char *ifname, FAR const char *essid) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Put the new ESSID into the request */ diff --git a/netutils/netlib/netlib_setifstatus.c b/netutils/netlib/netlib_setifstatus.c index 57e49f60c..8ed30fa9f 100644 --- a/netutils/netlib/netlib_setifstatus.c +++ b/netutils/netlib/netlib_setifstatus.c @@ -71,7 +71,7 @@ int netlib_ifup(const char *ifname) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Perform the ioctl to ifup flag */ @@ -114,7 +114,7 @@ int netlib_ifdown(const char *ifname) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Perform the ioctl to ifup flag */ diff --git a/netutils/netlib/netlib_setipv4addr.c b/netutils/netlib/netlib_setipv4addr.c index d2b2db6d2..dca8f09fb 100644 --- a/netutils/netlib/netlib_setipv4addr.c +++ b/netutils/netlib/netlib_setipv4addr.c @@ -71,7 +71,7 @@ int netlib_set_ipv4addr(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setipv4netmask.c b/netutils/netlib/netlib_setipv4netmask.c index dca7c3bee..c34b017f6 100644 --- a/netutils/netlib/netlib_setipv4netmask.c +++ b/netutils/netlib/netlib_setipv4netmask.c @@ -70,7 +70,7 @@ int netlib_set_ipv4netmask(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setipv6addr.c b/netutils/netlib/netlib_setipv6addr.c index 956303ddf..79cad9bd0 100644 --- a/netutils/netlib/netlib_setipv6addr.c +++ b/netutils/netlib/netlib_setipv6addr.c @@ -71,7 +71,7 @@ int netlib_set_ipv6addr(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.lifr_name, ifname, IFNAMSIZ); + strlcpy(req.lifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setipv6netmask.c b/netutils/netlib/netlib_setipv6netmask.c index ab6041270..985d55ed7 100644 --- a/netutils/netlib/netlib_setipv6netmask.c +++ b/netutils/netlib/netlib_setipv6netmask.c @@ -70,7 +70,7 @@ int netlib_set_ipv6netmask(FAR const char *ifname, /* Add the device name to the request */ - strncpy(req.lifr_name, ifname, IFNAMSIZ); + strlcpy(req.lifr_name, ifname, IFNAMSIZ); /* Add the INET address to the request */ diff --git a/netutils/netlib/netlib_setmacaddr.c b/netutils/netlib/netlib_setmacaddr.c index 55aed879b..07c3263ce 100644 --- a/netutils/netlib/netlib_setmacaddr.c +++ b/netutils/netlib/netlib_setmacaddr.c @@ -72,7 +72,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr) /* Put the driver name into the request */ - strncpy(req.ifr_name, ifname, IFNAMSIZ); + strlcpy(req.ifr_name, ifname, IFNAMSIZ); /* Put the new MAC address into the request */