Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2017 14:45:03 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r317555 - stable/11/usr.bin/netstat
Message-ID:  <201704281445.v3SEj3f5099781@repo.freebsd.org>

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



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