]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ESP: Remove padding, padding length and next header from the buffer
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 10 Feb 2021 19:48:18 +0000 (20:48 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 10 Feb 2021 19:55:02 +0000 (20:55 +0100)
Moreover:
Fix indentation.

print-esp.c

index 8b664b61ec8115da255684cd42dceb30e5de5b18..61c3e13bffdae2da778ca29f5732f5929a22aaff 100644 (file)
@@ -903,12 +903,20 @@ esp_print(netdissect_options *ndo,
 
        ND_PRINT(": ");
 
+       /*
+        * Don't put padding + padding length(1 byte) + next header(1 byte)
+        * in the buffer because they are not part of the plaintext to decode.
+        */
+       nd_push_snapend(ndo, ep - (padlen + 2));
+
        /* Now dissect the plaintext. */
        ip_demux_print(ndo, pt, payloadlen - (padlen + 2), ver, fragmented,
-           ttl_hl, nh, bp2);
+                      ttl_hl, nh, bp2);
 
        /* Pop the buffer, freeing it. */
        nd_pop_packet_info(ndo);
+       /* Pop the nd_push_snapend */
+       nd_pop_packet_info(ndo);
 #endif
 }
 #ifdef HAVE_LIBCRYPTO