]> The Tcpdump Group git mirrors - tcpdump/blobdiff - util.c
Include the new "slow protocol" printer.
[tcpdump] / util.c
diff --git a/util.c b/util.c
index d4882d72cc9a7311389c721d359fc9244949c234..178525d4a0c6af2c8acc77acc792a4eed719312a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.98 2005-05-06 07:56:54 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.100 2005-06-16 01:19:38 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -135,7 +135,7 @@ fn_printzp(register const u_char *s, register u_int n,
                }
                putchar(c);
        }
-       return (n == 0) ? 0 : 1;
+       return (n == 0) ? 0 : ret;
 }
 
 /*
@@ -242,8 +242,18 @@ relts_print(int secs)
 int
 print_unknown_data(const u_char *cp,const char *ident,int len)
 {
+       if (len < 0) {
+               printf("%sDissector error: print_unknown_data called with negative length",
+                   ident);
+               return(0);
+       }
        if (snapend - cp < len)
                len = snapend - cp;
+       if (len < 0) {
+               printf("%sDissector error: print_unknown_data called with pointer past end of packet",
+                   ident);
+               return(0);
+       }
         hex_print(ident,cp,len);
        return(1); /* everything is ok */
 }