Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/tcpdump/dist - pass correct size of buffer to s...



details:   https://anonhg.NetBSD.org/src/rev/70504d8ecfbb
branches:  trunk
changeset: 448555:70504d8ecfbb
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Feb 05 07:27:46 2019 +0000

description:
- pass correct size of buffer to snprintf() to avoid potential truncation

diffstat:

 external/bsd/tcpdump/dist/print-hncp.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r e83ba89da07b -r 70504d8ecfbb external/bsd/tcpdump/dist/print-hncp.c
--- a/external/bsd/tcpdump/dist/print-hncp.c    Tue Feb 05 07:18:52 2019 +0000
+++ b/external/bsd/tcpdump/dist/print-hncp.c    Tue Feb 05 07:27:46 2019 +0000
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-hncp.c,v 1.4 2017/09/08 14:01:13 christos Exp $");
+__RCSID("$NetBSD: print-hncp.c,v 1.5 2019/02/05 07:27:46 mrg Exp $");
 #endif
 
 /* \summary: Home Networking Control Protocol (HNCP) printer */
@@ -177,7 +177,7 @@
     static char buf[4][64+5];
     static int i = 0;
     i = (i + 1) % 4;
-    snprintf(buf[i], 28, "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64,
+    snprintf(buf[i], sizeof buf[i], "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64,
          EXTRACT_64BITS(data),
          EXTRACT_64BITS(data + 8),
          EXTRACT_64BITS(data + 16),



Home | Main Index | Thread Index | Old Index