diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2021-01-13 15:21:25 +0000 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2021-01-13 15:21:25 +0000 |
commit | 2e6a03c3f1c64ee0455b191cc58b78ea984aa1cb (patch) | |
tree | b669daa6f1caed4d26818f730672b708f3080add /util-print.c | |
parent | b53e72f26112af6705fe3a943ff54069fedbd770 (diff) | |
download | tcpdump-2e6a03c3f1c64ee0455b191cc58b78ea984aa1cb.tar.gz |
Refine print_unknown_data().
Use __func__ and ND_MIN() for simplicity.
Diffstat (limited to 'util-print.c')
-rw-r--r-- | util-print.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/util-print.c b/util-print.c index 925cf8d6..641078c0 100644 --- a/util-print.c +++ b/util-print.c @@ -458,17 +458,12 @@ int print_unknown_data(netdissect_options *ndo, const u_char *cp, const char *ident, 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", + ident, __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, ident, cp, ND_MIN(len, ND_BYTES_AVAILABLE_AFTER(cp))); return(1); /* everything is ok */ } |