From 4597c47c8b031e66fdecf9be5ab02e94150345e6 Mon Sep 17 00:00:00 2001 From: truckman Date: Fri, 20 May 2016 07:00:11 +0000 Subject: MFC r299867 Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. Reported by: Coverity CID: 974860, 1009972, 1009973 --- usr.sbin/rtadvd/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.sbin/rtadvd/config.c') diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index f0e11a3..b781ecc 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -634,7 +634,7 @@ getconfig_free_pfx: exit(1); } memset(&ndi, 0, sizeof(ndi)); - strncpy(ndi.ifname, ifi->ifi_ifname, sizeof(ndi.ifname)); + strlcpy(ndi.ifname, ifi->ifi_ifname, sizeof(ndi.ifname)); if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&ndi) < 0) syslog(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %s", __func__, ifi->ifi_ifname, strerror(errno)); -- cgit v1.1