2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

fix and simplify dns_rdataset_equal() and _equalx()

if both rdataslabs being compared have zero length, return true.

also, since these functions are only ever called on slabheaders
with sizeof(dns_slabheader_t) as the reserve length, we can
simplify the API: remove the reservelen argument, and pass the
slabs as type dns_slabheader_t * instead of unsigned char *.
This commit is contained in:
Evan Hunt
2025-02-06 15:50:52 -08:00
parent 15fe68e50d
commit 4601d4299a
3 changed files with 16 additions and 20 deletions

View File

@@ -2884,9 +2884,7 @@ find_header:
if (ACTIVE(header, now) && header->type == dns_rdatatype_ns &&
EXISTS(header) && EXISTS(newheader) &&
header->trust >= newheader->trust &&
dns_rdataslab_equalx((unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)),
dns_rdataslab_equalx(header, newheader,
qpdb->common.rdclass,
(dns_rdatatype_t)header->type))
{
@@ -2950,9 +2948,7 @@ find_header:
header->type == DNS_SIGTYPE(dns_rdatatype_ds)) &&
EXISTS(header) && EXISTS(newheader) &&
header->trust >= newheader->trust &&
dns_rdataslab_equal((unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader))))
dns_rdataslab_equal(header, newheader))
{
/*
* Honour the new ttl if it is less than the