Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2017 22:35:36 +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-10@freebsd.org
Subject:   svn commit: r319260 - stable/10/usr.bin/netstat
Message-ID:  <201705302235.v4UMZafU071678@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Tue May 30 22:35:36 2017
New Revision: 319260
URL: https://svnweb.freebsd.org/changeset/base/319260

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

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

Modified: stable/10/usr.bin/netstat/inet6.c
==============================================================================
--- stable/10/usr.bin/netstat/inet6.c	Tue May 30 22:34:43 2017	(r319259)
+++ stable/10/usr.bin/netstat/inet6.c	Tue May 30 22:35:36 2017	(r319260)
@@ -527,7 +527,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)
 			perror("Warning: ioctl(SIOCGIFSTAT_IN6)");
@@ -921,7 +921,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)
 			perror("Warning: ioctl(SIOCGIFSTAT_ICMP6)");



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