Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Apr 2017 15:15:10 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316610 - head/usr.bin/netstat
Message-ID:  <201704071515.v37FFAFO009323@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704071515.v37FFAFO009323>