]> git.puffer.fish Git - matthieu/frr.git/commitdiff
nhrpd: Use strlcpy not unsafe strncpy
authorReuben Dowle <reuben.dowle@4rf.com>
Thu, 4 Mar 2021 01:03:07 +0000 (14:03 +1300)
committerReuben Dowle <reuben.dowle@4rf.com>
Mon, 5 Apr 2021 21:23:42 +0000 (09:23 +1200)
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
nhrpd/linux.c

index 20825149b850cf8ec8cc83bf31626ac7e1497e94..e729f72644bd1d0ed5169ec3719601d1e14065a5 100644 (file)
 #include "os.h"
 #include "netlink.h"
 
+#ifndef HAVE_STRLCPY
+size_t strlcpy(char *__restrict dest,
+               const char *__restrict src, size_t destsize);
+#endif
+
 static int nhrp_socket_fd = -1;
 
 int os_socket(void)
@@ -112,7 +117,7 @@ static int linux_configure_arp(const char *iface, int on)
 {
        struct ifreq ifr;
 
-       strncpy(ifr.ifr_name, iface, IFNAMSIZ - 1);
+       strlcpy(ifr.ifr_name, iface, IFNAMSIZ);
        if (ioctl(nhrp_socket_fd, SIOCGIFFLAGS, &ifr))
                return -1;