]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-geneve.c
DNS: Sync types with IANA
[tcpdump] / print-geneve.c
index fa6791101ef0b95089a3c08007015c532346ecb4..0b7ff6e514728fd92eaf2d5332106f7bfef428d3 100644 (file)
@@ -156,6 +156,12 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len)
     ndo->ndo_protocol = "geneve";
     ND_PRINT("Geneve");
 
+    if (len < 8) {
+        ND_PRINT(" [length %u < 8]", len);
+        nd_print_invalid(ndo);
+        return;
+    }
+
     ND_TCHECK_8(bp);
 
     ver_opt = GET_U_1(bp);
@@ -224,9 +230,9 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len)
     else
         ND_PRINT("\n\t");
 
-    if (ethertype_print(ndo, prot, bp, len, ndo->ndo_snapend - bp, NULL, NULL) == 0) {
+    if (ethertype_print(ndo, prot, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL) == 0) {
         if (prot == ETHERTYPE_TEB)
-            ether_print(ndo, bp, len, ndo->ndo_snapend - bp, NULL, NULL);
+            ether_print(ndo, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
         else
             ND_PRINT("geneve-proto-0x%x", prot);
     }