From dff10c7f70d539c431a1eba9ab5e076d8b0f5c8e Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 17 Jan 2000 06:24:23 +0000 Subject: s/sprintf/snprintf/. there seem to be couple of unsafe use of strcat and strcpy - we should bring in strl{cat,cpy}. --- print-telnet.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'print-telnet.c') diff --git a/print-telnet.c b/print-telnet.c index beb6be91..cdce8398 100644 --- a/print-telnet.c +++ b/print-telnet.c @@ -51,7 +51,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.5 2000-01-09 21:34:20 fenner Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.6 2000-01-17 06:24:26 itojun Exp $"; #endif #include @@ -127,15 +127,16 @@ telnet_print(register const u_char *sp, u_int length) x = *sp++; /* option */ length--; if (x >= 0 && x < NTELOPTS) { - (void)sprintf(tnet, "%s %s", - telcmds[i], telopts[x]); + (void)snprintf(tnet, sizeof(tnet), + "%s %s", telcmds[i], telopts[x]); } else { - (void)sprintf(tnet, "%s %#x", - telcmds[i], x); + (void)snprintf(tnet, sizeof(tnet), + "%s %#x", telcmds[i], x); } break; default: - (void)strcpy(tnet, telcmds[i]); + (void)snprintf(tnet, sizeof(tnet), "%s", + telcmds[i]); } if (c == SB) { c = *sp++; -- cgit v1.2.1