From: Quentin Young Date: Tue, 26 Feb 2019 20:26:54 +0000 (+0000) Subject: nhrpd: strncpy -> strlcpy X-Git-Tag: 7.1_pulled~200^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=eb266ecb847b70bcf9901da5ed59a39d3e07fd8f;p=matthieu%2Ffrr.git nhrpd: strncpy -> strlcpy strncpy is a byte copy function not a string copy function Signed-off-by: Quentin Young --- diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 85e941e7ba..bb5ce0fec6 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -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; diff --git a/nhrpd/vici.c b/nhrpd/vici.c index 3de4609a2b..fab99588c8 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -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));