summaryrefslogtreecommitdiff
path: root/print-ascii.c
diff options
context:
space:
mode:
authoritojun <itojun>2000-01-17 06:24:23 +0000
committeritojun <itojun>2000-01-17 06:24:23 +0000
commitdff10c7f70d539c431a1eba9ab5e076d8b0f5c8e (patch)
tree29fbd05a7fa3afbeba9b422f86f9995c166d2eaa /print-ascii.c
parent92d3fd1b47a8c041297a3dfa655f0d548012f61c (diff)
downloadtcpdump-dff10c7f70d539c431a1eba9ab5e076d8b0f5c8e.tar.gz
s/sprintf/snprintf/.
there seem to be couple of unsafe use of strcat and strcpy - we should bring in strl{cat,cpy}.
Diffstat (limited to 'print-ascii.c')
-rw-r--r--print-ascii.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/print-ascii.c b/print-ascii.c
index 882f2474..a97faf77 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.4 2000-01-09 21:34:16 fenner Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.5 2000-01-17 06:24:24 itojun Exp $";
#endif
#include <stdio.h>
#include <sys/types.h>
@@ -72,7 +72,7 @@ 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(hsp), " %02x%02x", s1, s2);
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
*(asp++) = (isgraph(s1) ? s1 : '.');
*(asp++) = (isgraph(s2) ? s2 : '.');
@@ -87,7 +87,7 @@ 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(hsp), " %02x", s1);
hsp += 3;
*(asp++) = (isgraph(s1) ? s1 : '.');
++i;