]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Print the length in the truncation message if we know it.
authorfenner <fenner>
Wed, 12 Mar 2003 19:25:40 +0000 (19:25 +0000)
committerfenner <fenner>
Wed, 12 Mar 2003 19:25:40 +0000 (19:25 +0000)
Fix the CID parser for type=0 (ASCII text) client IDs.
Make the overall parser a little more robust to buggy parsers like
 the CID one by incrementing bp when there are bytes left over.

print-bootp.c

index ebf4739d660aceb8c6fb302483270192570dd98d..88e1e8472eb8c4329f4d1748f842e3dd2cbaf917 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.69 2002-12-18 08:53:20 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.70 2003-03-12 19:25:40 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -376,7 +376,7 @@ rfc1048_print(register const u_char *bp)
                }
                len = *bp++;
                if (bp + len >= snapend) {
-                       fputs(tstr, stdout);
+                       printf("[|bootp %u]", len);
                        return;
                }
 
@@ -571,6 +571,8 @@ rfc1048_print(register const u_char *bp)
                                        putchar('"');
                                        (void)fn_printn(bp, size, NULL);
                                        putchar('"');
+                                       bp += size;
+                                       size = 0;
                                        break;
                                } else {
                                        printf("[%s]", tok2str(arp2str, "type-%d", type));
@@ -596,8 +598,10 @@ rfc1048_print(register const u_char *bp)
                        break;
                }
                /* Data left over? */
-               if (size)
+               if (size) {
                        printf("[len %u]", len);
+                       bp += size;
+               }
        }
        return;
 trunc: