diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-12-07 19:53:32 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-12-07 19:53:32 +0000 |
commit | 53f02f3f686fba4a2dca70fd40d76b8552e14494 (patch) | |
tree | 4850c359ff2f160ba7e6f59f4b8518cdeca68184 | |
parent | 2c820ddb4cce0d2fa79ec6c190db8a2b33086a13 (diff) |
Do not use strlcpy if the source string is not NUL terminated and
avoid printing funny chars. Problem spotted by naddy@ whil tcpdumping
enc0 with malloc.conf AJ; ok canacar@ on an earlier version.
-rw-r--r-- | usr.sbin/tcpdump/print-ntp.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/tcpdump/print-ntp.c b/usr.sbin/tcpdump/print-ntp.c index 161c5e474ec..3b84a122a1c 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.11 2002/02/19 19:39:40 millert Exp $ */ +/* $OpenBSD: print-ntp.c,v 1.12 2005/12/07 19:53:31 otto Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -27,7 +27,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ntp.c,v 1.11 2002/02/19 19:39:40 millert Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ntp.c,v 1.12 2005/12/07 19:53:31 otto Exp $ (LBL)"; #endif #include <sys/param.h> @@ -64,7 +64,6 @@ ntp_print(register const u_char *cp, u_int length) { register const struct ntpdata *bp; int mode, version, leapind; - static char rclock[5]; bp = (struct ntpdata *)cp; /* Note funny sized packets */ @@ -159,8 +158,7 @@ ntp_print(register const u_char *cp, u_int length) break; case PRIM_REF: - strlcpy(rclock, (char *)&(bp->refid), sizeof(rclock)); - fputs(rclock, stdout); + fn_printn((u_char *)&bp->refid, sizeof(bp->refid), NULL); break; case INFO_QUERY: |