X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7217abf41a060c9e9b5cdde30a759e79329a1b00..refs/heads/master:/print-ssh.c diff --git a/print-ssh.c b/print-ssh.c index bb983355..f9dd419c 100644 --- a/print-ssh.c +++ b/print-ssh.c @@ -13,14 +13,10 @@ /* \summary: Secure Shell (SSH) printer */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" - -#include -#include +#include "netdissect-ctype.h" #include "netdissect.h" #include "extract.h" @@ -44,14 +40,17 @@ ssh_print_version(netdissect_options *ndo, const u_char *pptr, u_int len) idx++; while (idx < len) { - if (GET_U_1(pptr + idx) == '\n') { + u_char c; + + c = GET_U_1(pptr + idx); + if (c == '\n') { /* * LF without CR; end of line. * Skip the LF and print the line, with the * exception of the LF. */ goto print; - } else if (GET_U_1(pptr + idx) == '\r') { + } else if (c == '\r') { /* CR - any LF? */ if ((idx+1) >= len) { /* not in this packet */ @@ -71,8 +70,7 @@ ssh_print_version(netdissect_options *ndo, const u_char *pptr, u_int len) * if it were binary data and don't print it. */ goto trunc; - } else if (!isascii(GET_U_1(pptr + idx)) || - !isprint(GET_U_1(pptr + idx)) ) { + } else if (!ND_ASCII_ISPRINT(c) ) { /* * Not a printable ASCII character; treat this * as if it were binary data and don't print it.