svn commit: r316610 - head/usr.bin/netstat

Alan Somers asomers at FreeBSD.org
Fri Apr 7 15:15:12 UTC 2017


Author: asomers
Date: Fri Apr  7 15:15:10 2017
New Revision: 316610
URL: https://svnweb.freebsd.org/changeset/base/316610

Log:
  usr.bin/netstat: strcpy -> strlcpy
  
  Reported by:	Coverity
  CID:		1006741, 1006744
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp

Modified:
  head/usr.bin/netstat/inet6.c

Modified: head/usr.bin/netstat/inet6.c
==============================================================================
--- head/usr.bin/netstat/inet6.c	Fri Apr  7 14:43:28 2017	(r316609)
+++ head/usr.bin/netstat/inet6.c	Fri Apr  7 15:15:10 2017	(r316610)
@@ -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)");


More information about the svn-src-head mailing list