Fix net/lib_nametoindex.c:58:7: error: 'strncpy' specified bound 16 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
8267a76186
commit
be2f688cd9
|
@ -55,7 +55,7 @@ unsigned int if_nametoindex(FAR const char *ifname)
|
|||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
strncpy(req.ifr_name, ifname, IF_NAMESIZE);
|
||||
strlcpy(req.ifr_name, ifname, IF_NAMESIZE);
|
||||
if (ioctl(sockfd, SIOCGIFINDEX, (unsigned long)&req) >= 0)
|
||||
{
|
||||
close(sockfd);
|
||||
|
|
Loading…
Reference in New Issue