Verify rdlen field in RRSIG packets. CVE-2026-4891

Bug report from Royce M <royce@xchglabs.com>

This avoids crafted packets which give a value for rdlen _less_
then the space taken up by the fixed data and the signer's name
and engender a negative calculated length for the signature.
This commit is contained in:
Simon Kelley committed 2026-05-10 21:49:40 +01:00
1 parent 7b151eb606
commit 788b4e0f6c
1 file changed
+7 -3
+7 -3
View File
@@ -543,10 +543,14 @@ static int validate_rrset(time_t now, struct dns_header *header, size_t plen, in
*ttl_out = ttl;
}
/* Don't trust rdlen not to be too small and give us a negative sig_len
It has already been checked that it doesn't run us off the end
of the packet. */
if ((sig_len = rdlen - (p - psav)) <= 0)
return STAT_BOGUS;
sig = p;
sig_len = rdlen - (p - psav);
nsigttl = htonl(orig_ttl);
hash->update(ctx, 18, psav);