From be2f688cd9ec5acf592e26d0710f51393b2537bb Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 2 Mar 2022 23:30:47 +0800 Subject: [PATCH] Fix net/lib_nametoindex.c:58:7: error: 'strncpy' specified bound 16 equals destination size Signed-off-by: Xiang Xiao --- libs/libc/net/lib_nametoindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/net/lib_nametoindex.c b/libs/libc/net/lib_nametoindex.c index 1dcc0284f5..8adc63817b 100644 --- a/libs/libc/net/lib_nametoindex.c +++ b/libs/libc/net/lib_nametoindex.c @@ -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);