]> The Tcpdump Group git mirrors - tcpdump/blobdiff - util-print.c
Rename a test. It's about the AppleTalk protocol
[tcpdump] / util-print.c
index 925cf8d6a34be0e0a9e1a2d1bac70c114fcf72bf..d65f026608a72a5b262d435a6b60b2736eddfdaa 100644 (file)
@@ -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 */
 }