Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat Fix snprintf usage; from Henning Petersen in...
details: https://anonhg.NetBSD.org/src/rev/9674654ab339
branches: trunk
changeset: 331021:9674654ab339
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jul 27 04:26:23 2014 +0000
description:
Fix snprintf usage; from Henning Petersen in PR 47976.
diffstat:
usr.bin/netstat/show.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 52bb1d2b79f7 -r 9674654ab339 usr.bin/netstat/show.c
--- a/usr.bin/netstat/show.c Sun Jul 27 04:23:44 2014 +0000
+++ b/usr.bin/netstat/show.c Sun Jul 27 04:26:23 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.19 2014/04/28 15:41:15 christos Exp $ */
+/* $NetBSD: show.c,v 1.20 2014/07/27 04:26:23 dholland Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
/*
@@ -705,6 +705,7 @@
mpls_ntoa(const struct sockaddr *sa)
{
static char obuf[16];
+ size_t olen;
const union mpls_shim *pms;
union mpls_shim ms;
int psize = sizeof(struct sockaddr_mpls);
@@ -717,7 +718,8 @@
while(psize < sa->sa_len) {
pms++;
ms.s_addr = ntohl(pms->s_addr);
- snprintf(obuf, sizeof(obuf), "%s,%u", obuf,
+ olen = strlen(obuf);
+ snprintf(obuf + olen, sizeof(obuf) - olen, ",%u",
ms.shim.label);
psize+=sizeof(ms);
}
Home |
Main Index |
Thread Index |
Old Index