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)");
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to