]> git.proxmox.com Git - mirror_frr.git/commitdiff
nhrpd: strncpy -> strlcpy
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 26 Feb 2019 20:26:54 +0000 (20:26 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 26 Feb 2019 20:50:17 +0000 (20:50 +0000)
strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
nhrpd/linux.c
nhrpd/vici.c

index 85e941e7bacd1d63fed3300fe7e708df39c4f420..bb5ce0fec6b2c41e65a087a8c020e1ecbf33b0c2 100644 (file)
@@ -110,7 +110,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, sizeof(ifr.ifr_name));
        if (ioctl(nhrp_socket_fd, SIOCGIFFLAGS, &ifr))
                return -1;
 
index 3de4609a2bc435966bbb18d6881b370db08b14d7..fab99588c86cb10a08109f9d20172f46bbd1973c 100644 (file)
@@ -550,7 +550,7 @@ int sock_open_unix(const char *path)
 
        memset(&addr, 0, sizeof(struct sockaddr_un));
        addr.sun_family = AF_UNIX;
-       strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
+       strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
 
        ret = connect(fd, (struct sockaddr *)&addr,
                      sizeof(addr.sun_family) + strlen(addr.sun_path));