Module Name: src Committed By: christos Date: Fri Jun 6 15:33:14 UTC 2014
Modified Files: src/libexec/rpc.rstatd: rstat_proc.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/libexec/rpc.rstatd/rstat_proc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/rpc.rstatd/rstat_proc.c diff -u src/libexec/rpc.rstatd/rstat_proc.c:1.50 src/libexec/rpc.rstatd/rstat_proc.c:1.51 --- src/libexec/rpc.rstatd/rstat_proc.c:1.50 Mon Jun 2 15:29:58 2014 +++ src/libexec/rpc.rstatd/rstat_proc.c Fri Jun 6 11:33:14 2014 @@ -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 @@ updatestat(int dummy) } 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;