]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppp.c
PPP: Change the pointer to packet data
[tcpdump] / print-ppp.c
index baeb4f00494aa4e6ddb8cee35f924b7a6f1b6363..76494410982e0798bfd4f924d41b49c5c5b42fea 100644 (file)
@@ -1363,7 +1363,7 @@ ppp_hdlc(netdissect_options *ndo,
        u_char *b, *t, c;
        const u_char *s;
        u_int i, proto;
-       const void *se;
+       const void *sb, *se;
 
        if (caplen == 0)
                return;
@@ -1395,8 +1395,11 @@ ppp_hdlc(netdissect_options *ndo,
 
        /*
         * Change the end pointer, so bounds checks work.
+        * Change the pointer to packet data to help debugging.
         */
+       sb = ndo->ndo_packetp;
        se = ndo->ndo_snapend;
+       ndo->ndo_packetp = b;
        ndo->ndo_snapend = t;
        length = ND_BYTES_AVAILABLE_AFTER(b);
 
@@ -1433,10 +1436,12 @@ ppp_hdlc(netdissect_options *ndo,
         }
 
 cleanup:
+       ndo->ndo_packetp = sb;
        ndo->ndo_snapend = se;
         return;
 
 trunc:
+       ndo->ndo_packetp = sb;
        ndo->ndo_snapend = se;
        nd_print_trunc(ndo);
 }