svn commit: r317555 - stable/11/usr.bin/netstat

Alan Somers asomers at FreeBSD.org
Fri Apr 28 14:45:05 UTC 2017


Author: asomers
Date: Fri Apr 28 14:45:03 2017
New Revision: 317555
URL: https://svnweb.freebsd.org/changeset/base/317555

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

Modified:
  stable/11/usr.bin/netstat/inet6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/netstat/inet6.c
==============================================================================
--- stable/11/usr.bin/netstat/inet6.c	Fri Apr 28 14:43:14 2017	(r317554)
+++ stable/11/usr.bin/netstat/inet6.c	Fri Apr 28 14:45:03 2017	(r317555)
@@ -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-all mailing list