]> The Tcpdump Group git mirrors - tcpdump/commitdiff
domain: handle too-short URI RRs correctly.
authorGuy Harris <[email protected]>
Sat, 24 Feb 2024 23:55:30 +0000 (15:55 -0800)
committerGuy Harris <[email protected]>
Thu, 29 Feb 2024 02:02:40 +0000 (18:02 -0800)
Just report the problem and drive on, not trying to print the contents.

(cherry picked from commit 63f720690fe8a087ef8fafb6fc3ba0c4a8b981de)

print-domain.c

index d93aee73b254b65014563a75ad45a38e6243322d..dcbd982cb4e3a520aca1bfd6e2f78512e1a2304f 100644 (file)
@@ -839,7 +839,10 @@ ns_rprint(netdissect_options *ndo,
        case T_URI:
                if (!ND_TTEST_LEN(cp, len))
                        return(NULL);
-               ND_ICHECK_U(len, <, 4);
+               if (len < 4) {
+                       ND_PRINT(" len %u is too short (< 4)", len);
+                       break;
+               }
                ND_PRINT(" %u %u ", GET_BE_U_2(cp), GET_BE_U_2(cp + 2));
                if (nd_printn(ndo, cp + 4, len - 4, ndo->ndo_snapend))
                        return(NULL);
@@ -895,8 +898,6 @@ ns_rprint(netdissect_options *ndo,
            }
        }
        return (rp);            /* XXX This isn't always right */
-invalid:
-       nd_print_invalid(ndo);
 }
 
 void