Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ifconfig Consistently use estrlcpy for ifr.ifr_name her...



details:   https://anonhg.NetBSD.org/src/rev/85921dbc89dd
branches:  trunk
changeset: 814016:85921dbc89dd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 29 16:23:25 2016 +0000

description:
Consistently use estrlcpy for ifr.ifr_name here, not strncpy.

diffstat:

 sbin/ifconfig/af_inet.c  |  6 +++---
 sbin/ifconfig/af_inet6.c |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 1943820d9cfd -r 85921dbc89dd sbin/ifconfig/af_inet.c
--- a/sbin/ifconfig/af_inet.c   Mon Feb 29 16:19:20 2016 +0000
+++ b/sbin/ifconfig/af_inet.c   Mon Feb 29 16:23:25 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_inet.c,v 1.18 2016/01/07 11:32:21 roy Exp $ */
+/*     $NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_inet.c,v 1.18 2016/01/07 11:32:21 roy Exp $");
+__RCSID("$NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -231,7 +231,7 @@
        struct ifreq ifr;
 
        memset(&ifr, 0, sizeof(ifr));
-       strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
+       estrlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
        ifr.ifr_addr = *ifa->ifa_addr;
        if ((s = getsock(AF_INET)) == -1)
                err(EXIT_FAILURE, "%s: getsock", __func__);
diff -r 1943820d9cfd -r 85921dbc89dd sbin/ifconfig/af_inet6.c
--- a/sbin/ifconfig/af_inet6.c  Mon Feb 29 16:19:20 2016 +0000
+++ b/sbin/ifconfig/af_inet6.c  Mon Feb 29 16:23:25 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_inet6.c,v 1.34 2016/01/07 11:32:21 roy Exp $        */
+/*     $NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_inet6.c,v 1.34 2016/01/07 11:32:21 roy Exp $");
+__RCSID("$NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -488,7 +488,7 @@
        if ((s = getsock(AF_INET6)) == -1)
                err(EXIT_FAILURE, "%s: getsock", __func__);
        memset(&ifr, 0, sizeof(ifr));
-       strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
+       estrlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
        ifr.ifr_addr = *(struct sockaddr_in6 *)ifa->ifa_addr;
        if (prog_ioctl(s, SIOCGIFAFLAG_IN6, &ifr) == -1)
                err(EXIT_FAILURE, "SIOCGIFAFLAG_IN6");



Home | Main Index | Thread Index | Old Index