]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-nfs.c
ICMPv6: print RFC8335 PROBE extended echo/reply messages
[tcpdump] / print-nfs.c
index bbce49536f2acf653179c742e85bccc4d324c534..b67ec370ed67a7bf4b2082b9c68d0ce61662a44e 100644 (file)
@@ -21,9 +21,7 @@
 
 /* \summary: Network File System (NFS) printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -434,6 +432,11 @@ parsereq(netdissect_options *ndo,
        if (length < 2 * sizeof(*dp))
                goto trunc;
        len = GET_BE_U_4(dp + 1);
+       if (len > length) {
+               ND_PRINT(" [credentials length %u > %u]", len, length);
+               nd_print_invalid(ndo);
+               return NULL;
+       }
        rounded_len = roundup2(len, 4);
        ND_TCHECK_LEN(dp + 2, rounded_len);
        if (2 * sizeof(*dp) + rounded_len <= length) {
@@ -453,6 +456,11 @@ parsereq(netdissect_options *ndo,
                if (length < 2 * sizeof(*dp))
                        goto trunc;
                len = GET_BE_U_4(dp + 1);
+               if (len > length) {
+                       ND_PRINT(" [verifier length %u > %u]", len, length);
+                       nd_print_invalid(ndo);
+                       return NULL;
+               }
                rounded_len = roundup2(len, 4);
                ND_TCHECK_LEN(dp + 2, rounded_len);
                if (2 * sizeof(*dp) + rounded_len < length) {