X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/f867bc9f40b4ce00e08fa6377bbb7d74719b9313..e4adb4b6e18aae3017797c8f214fd7dd0dd51efc:/util-print.c diff --git a/util-print.c b/util-print.c index 925cf8d6..d65f0266 100644 --- a/util-print.c +++ b/util-print.c @@ -456,19 +456,14 @@ void nd_print_invalid(netdissect_options *ndo) int print_unknown_data(netdissect_options *ndo, const u_char *cp, - const char *ident, u_int len) + const char *indent, u_int len) { - u_int len_to_print; - - len_to_print = len; if (!ND_TTEST_LEN(cp, 0)) { - ND_PRINT("%sDissector error: print_unknown_data called with pointer past end of packet", - ident); + ND_PRINT("%sDissector error: %s() called with pointer past end of packet", + indent, __func__); return(0); } - if (ND_BYTES_AVAILABLE_AFTER(cp) < len_to_print) - len_to_print = ND_BYTES_AVAILABLE_AFTER(cp); - hex_print(ndo, ident, cp, len_to_print); + hex_print(ndo, indent, cp, ND_MIN(len, ND_BYTES_AVAILABLE_AFTER(cp))); return(1); /* everything is ok */ }