usr.bin/netstat: strcpy -> strlcpy

Reported by:	Coverity
CID:		1006741, 1006744
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
This commit is contained in:
Alan Somers 2017-04-07 15:15:10 +00:00
parent 22cbd6ef2e
commit 2b8aaacea9

View File

@ -618,7 +618,7 @@ ip6_ifstats(char *ifname)
return;
}
strcpy(ifr.ifr_name, ifname);
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFSTAT_IN6, (char *)&ifr) < 0) {
if (errno != EPFNOSUPPORT)
xo_warn("Warning: ioctl(SIOCGIFSTAT_IN6)");
@ -1079,7 +1079,7 @@ icmp6_ifstats(char *ifname)
return;
}
strcpy(ifr.ifr_name, ifname);
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFSTAT_ICMP6, (char *)&ifr) < 0) {
if (errno != EPFNOSUPPORT)
xo_warn("Warning: ioctl(SIOCGIFSTAT_ICMP6)");