]> The Tcpdump Group git mirrors - tcpdump/commitdiff
DNS: Add a length check
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 8 Aug 2019 12:31:32 +0000 (14:31 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 8 Aug 2019 12:48:35 +0000 (14:48 +0200)
Update the output of three tests accordingly.

(backported from commit 6b5d1df56e90de2abd1a1813922e39e195602c89)

print-domain.c
tests/dns-zlip-1.out
tests/dns-zlip-2.out
tests/dns-zlip-3.out

index 9a2b9e85687b633fcb4564ff299cd85f738c358e..e29a9b4b0f9be579f063f9d8b3dc52c568745043 100644 (file)
@@ -582,6 +582,13 @@ ns_print(netdissect_options *ndo,
        register const u_char *cp;
        uint16_t b2;
 
+       if(length < sizeof(*np)) {
+               ND_PRINT((ndo, "domain"));
+               ND_PRINT((ndo, " [length %u < %zu]", length, sizeof(*np)));
+               ND_PRINT((ndo, " (invalid)"));
+               return;
+       }
+
        np = (const HEADER *)bp;
        ND_TCHECK(*np);
        /* get the byte-order right */
index ce12748da260f4da98145cc6a5b34552a5facaad..21fc1ccb85d6401a6c8bef35ff4572ce82369373 100644 (file)
@@ -1 +1 @@
-IP 10.0.0.1.1024 > 146.84.28.88.53: 60777 Type49159 (Class 49168)? <BAD PTR>[|domain]
+IP 10.0.0.1.1024 > 146.84.28.88.53: domain [length 0 < 12] (invalid)
index dbabefbfc105674270fcdf9122a4b65eb43a786d..21fc1ccb85d6401a6c8bef35ff4572ce82369373 100644 (file)
@@ -1 +1 @@
-IP 10.0.0.1.1024 > 146.84.28.88.53: 18992 Type49164 (Class 49168)? <BAD PTR>[|domain]
+IP 10.0.0.1.1024 > 146.84.28.88.53: domain [length 0 < 12] (invalid)
index beb173045bbcafa1beb265bd4000203493dd7a41..21fc1ccb85d6401a6c8bef35ff4572ce82369373 100644 (file)
@@ -1 +1 @@
-IP 10.0.0.1.1024 > 146.84.28.88.53: 65483 Type49164 (Class 49164)? thisleetostringwillcrashyourlittlenameserverforsurehahahahahah.<BAD PTR>[|domain]
+IP 10.0.0.1.1024 > 146.84.28.88.53: domain [length 0 < 12] (invalid)