diff options
author | fenner <fenner@FreeBSD.org> | 2001-04-03 07:45:48 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2001-04-03 07:45:48 +0000 |
commit | ace14a2b50f2cc05c079d0b9137b49066dbb1206 (patch) | |
tree | 4953fdd47c44b8ec88d34a4db7b698841365e22f /contrib/tcpdump/print-telnet.c | |
parent | 54c4a9c9f2aca2e032cbf41f5eb012e2e9628dd4 (diff) | |
download | FreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.zip FreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.tar.gz |
Virgin import of tcpdump.org tcpdump v3.6.2
Diffstat (limited to 'contrib/tcpdump/print-telnet.c')
-rw-r--r-- | contrib/tcpdump/print-telnet.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/contrib/tcpdump/print-telnet.c b/contrib/tcpdump/print-telnet.c index bb0f4ab..bad4e7d 100644 --- a/contrib/tcpdump/print-telnet.c +++ b/contrib/tcpdump/print-telnet.c @@ -51,35 +51,28 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.2.2.2 2000/01/11 06:58:28 fenner Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.12 2000/09/29 04:58:51 guy Exp $"; #endif #include <sys/param.h> #include <sys/time.h> #include <sys/types.h> +#include <ctype.h> #include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip.h> -#include <netinet/ip_var.h> -#include <netinet/tcp.h> -#include <netinet/tcpip.h> #define TELCMDS #define TELOPTS #include <arpa/telnet.h> #include <stdio.h> -#ifdef __STDC__ #include <stdlib.h> -#endif #include <unistd.h> #include <string.h> #include "interface.h" #include "addrtoname.h" - #ifndef TELCMD_FIRST # define TELCMD_FIRST SE #endif @@ -128,15 +121,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++; @@ -174,11 +168,13 @@ telnet_print(register const u_char *sp, u_int length) hex_print_with_offset(osp, i, off); off += i; if (i > 8) - printf("\n\t\t\t\t%s", tnet); + printf("\n\t\t\t\t"); else - printf("%*s\t%s", (8 - i) * 3, "", tnet); + printf("%*s\t", (8 - i) * 3, ""); + safeputs(tnet); } else { - printf("%s%s", (first) ? " [telnet " : ", ", tnet); + printf("%s", (first) ? " [telnet " : ", "); + safeputs(tnet); } first = 0; } |