nhrpd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2019-02-26 20:26:54 +00:00
parent aab9a0a0cb
commit eb266ecb84
2 changed files with 2 additions and 2 deletions

View 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;

View 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));