]> The Tcpdump Group git mirrors - tcpdump/blobdiff - util.c
Add missing bounds checking to the DVMRP and PIM print routines.
[tcpdump] / util.c
diff --git a/util.c b/util.c
index ad7e3fdeb1e1d909a55c0600c8f8f6226bfba957..088c14e76fc7b78110786cb6b1c4a219003af7e1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -20,8 +20,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.85 2003-04-21 16:59:52 fenner Exp $ (LBL)";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.87.2.2 2003-11-16 08:51:58 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -217,7 +217,7 @@ print_unknown_data(const u_char *cp,const char *lf,int len)
                printf(" ");
            if (i/16!=(i+1)/16) {
                if (i<(len-1))
-                   printf("%s0x%04x: ",lf,i);
+                   printf("%s0x%04x: ",lf,i+1);
            }
        }
        return(1); /* everything is ok */
@@ -328,15 +328,15 @@ mask2plen (u_int32_t mask)
                0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
                0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff
        };
-       int prefix_len = 33;
+       int prefix_len = 32;
 
-        /* lets see if we can transform the mask into a prefixlen */
-        while (prefix_len >= 0) {
-            if (bitmasks[prefix_len] == mask)
-                break;
-            prefix_len--;
-        }
-        return (prefix_len);
+       /* let's see if we can transform the mask into a prefixlen */
+       while (prefix_len >= 0) {
+               if (bitmasks[prefix_len] == mask)
+                       break;
+               prefix_len--;
+       }
+       return (prefix_len);
 }
 
 /* VARARGS */