summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/print-ntp.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2001-11-07 18:48:16 +0000
committerderaadt <deraadt@openbsd.org>2001-11-07 18:48:16 +0000
commit9f840a032a88dde66ea8f79aaeeba45bc86e04ca (patch)
treec9105e6f57b0e6abcaa5129574ba304aa47b8795 /usr.sbin/tcpdump/print-ntp.c
parentavoid buffer overflows. when will people learn to use snprintf correctly (diff)
downloadwireguard-openbsd-9f840a032a88dde66ea8f79aaeeba45bc86e04ca.tar.xz
wireguard-openbsd-9f840a032a88dde66ea8f79aaeeba45bc86e04ca.zip
simplify buffer handling; ok ho
Diffstat (limited to 'usr.sbin/tcpdump/print-ntp.c')
-rw-r--r--usr.sbin/tcpdump/print-ntp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-ntp.c b/usr.sbin/tcpdump/print-ntp.c
index d42885c619a..bd78ae7ada2 100644
--- a/usr.sbin/tcpdump/print-ntp.c
+++ b/usr.sbin/tcpdump/print-ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ntp.c,v 1.9 2000/10/03 14:31:58 ho Exp $ */
+/* $OpenBSD: print-ntp.c,v 1.10 2001/11/07 18:48:16 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-ntp.c,v 1.9 2000/10/03 14:31:58 ho Exp $ (LBL)";
+ "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-ntp.c,v 1.10 2001/11/07 18:48:16 deraadt Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -161,8 +161,7 @@ ntp_print(register const u_char *cp, u_int length)
break;
case PRIM_REF:
- strncpy(rclock, (char *)&(bp->refid), 4);
- rclock[4] = '\0';
+ strlcpy(rclock, (char *)&(bp->refid), sizeof(rclock));
fputs(rclock, stdout);
break;