X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/49b23c5a9b0198bb382dcf43c458d46fcf2fa809..d7b497cac78b6e22a66a6bae9bdec60a8044f67a:/print-telnet.c diff --git a/print-telnet.c b/print-telnet.c index a6640346..e3782177 100644 --- a/print-telnet.c +++ b/print-telnet.c @@ -56,6 +56,7 @@ #include #include "netdissect.h" +#include "extract.h" static const char tstr[] = " [|telnet]"; @@ -437,11 +438,12 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print) /* IAC SB .... IAC SE */ p = sp; while (length > (u_int)(p + 1 - sp)) { - ND_TCHECK2(*p, 2); + ND_TCHECK_2(p); if (p[0] == IAC && p[1] == SE) break; p++; } + ND_TCHECK(*p); if (*p != IAC) goto pktend; @@ -514,7 +516,7 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length) osp = sp; ND_TCHECK(*sp); - while (length > 0 && *sp == IAC) { + while (length > 0 && EXTRACT_U_1(sp) == IAC) { /* * Parse the Telnet command without printing it, * to determine its length.