Source-Changes-HG archive

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

[src/trunk]: src/libexec/rpc.rstatd Although the kernel handles non-NUL termi...



details:   https://anonhg.NetBSD.org/src/rev/73fc640fe4d1
branches:  trunk
changeset: 329750:73fc640fe4d1
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 06 15:33:14 2014 +0000

description:
Although the kernel handles non-NUL terminated interface names, it is better
to avoid this, and all other places that create ifdr_name use strlcpy anyway
so make it conform.

diffstat:

 libexec/rpc.rstatd/rstat_proc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ba2ae1794def -r 73fc640fe4d1 libexec/rpc.rstatd/rstat_proc.c
--- a/libexec/rpc.rstatd/rstat_proc.c   Fri Jun 06 15:00:20 2014 +0000
+++ b/libexec/rpc.rstatd/rstat_proc.c   Fri Jun 06 15:33:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rstat_proc.c,v 1.50 2014/06/02 19:29:58 joerg Exp $    */
+/*     $NetBSD: rstat_proc.c,v 1.51 2014/06/06 15:33:14 christos Exp $ */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: rstat_proc.c,v 1.50 2014/06/02 19:29:58 joerg Exp $");
+__RCSID("$NetBSD: rstat_proc.c,v 1.51 2014/06/06 15:33:14 christos Exp $");
 
 /*
  * rstat service:  built with rstat.x and derived from rpc.rstatd.c
@@ -254,7 +254,7 @@
        }
        s = socket(AF_INET, SOCK_DGRAM, 0);
        for (i = 0; s != -1 && ifps[i].if_name != NULL; ++i) {
-               strncpy(ifdr.ifdr_name, ifps[i].if_name, sizeof(ifdr.ifdr_name));
+               strlcpy(ifdr.ifdr_name, ifps[i].if_name, sizeof(ifdr.ifdr_name));
                if (ioctl(s, SIOCGIFDATA, &ifdr) != 0)
                        continue;
                stats_all.s3.if_ipackets += ifdr.ifdr_data.ifi_ipackets;



Home | Main Index | Thread Index | Old Index