X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b35a056ecffb5e8f1e31d4f6c6c9fb4a14bb7fb5..f40a38aa78f012cd4fa42fbfe4b88a509260fbaa:/print-ascii.c diff --git a/print-ascii.c b/print-ascii.c index 6a6b845a..c8f65fd3 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -40,11 +40,9 @@ #include "config.h" #endif -#include -#if 0 #ifndef lint -__RCSID("$NetBSD: print-ascii.c,v 1.1 1999/09/30 14:49:12 sjg Exp $"); -#endif +static const char rcsid[] = + "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.6 2000-01-29 16:47:46 itojun Exp $"; #endif #include #include @@ -74,7 +72,8 @@ ascii_print_with_offset(register const u_char *cp, register u_int length, while (--nshorts >= 0) { s1 = *cp++; s2 = *cp++; - (void)sprintf(hsp, " %02x%02x", s1, s2); + (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), + " %02x%02x", s1, s2); hsp += HEXDUMP_HEXSTUFF_PER_SHORT; *(asp++) = (isgraph(s1) ? s1 : '.'); *(asp++) = (isgraph(s2) ? s2 : '.'); @@ -89,7 +88,8 @@ ascii_print_with_offset(register const u_char *cp, register u_int length, } if (length & 1) { s1 = *cp++; - (void)sprintf(hsp, " %02x", s1); + (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), + " %02x", s1); hsp += 3; *(asp++) = (isgraph(s1) ? s1 : '.'); ++i;