diff --git a/CHANGES b/CHANGES index 763633b90c..b81cf242e2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3599. [tuning] Check for pointer equivalence in name comparisons. + [RT #18125] + 3594. [maint] Update config.guess and config.sub. [RT #33816] 3592. [doc] Moved documentation of rndc command options to the diff --git a/lib/dns/name.c b/lib/dns/name.c index 1ebda616af..b0dd8fe323 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -577,6 +577,11 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) == (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); + if (name1 == name2) { + *orderp = 0; + return (dns_namereln_equal); + } + SETUP_OFFSETS(name1, offsets1, odata1); SETUP_OFFSETS(name2, offsets2, odata2); @@ -690,6 +695,9 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) == (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); + if (name1 == name2) + return (ISC_TRUE); + if (name1->length != name2->length) return (ISC_FALSE);