Subject: | dns_name_fullcompare() doesn't fill nlabelsp correctly if names are equal |
Date: | Mon, 15 Sep 2014 17:41:21 +0200 |
To: | bind9-bugs@isc.org |
From: | Petr Spacek <pspacek@redhat.com> |
Hello,
I just found out that dns_name_fullcompare() description is not correct or the
function contains a bug.
name.h promises this:
dns_namereln_t
dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
int *orderp, unsigned int *nlabelsp);
<snip>
* Ensures:
*
*\li *orderp is < 0 if name1 < name2, 0 if name1 = name2, > 0 if
* name1 > name2.
*
*\li *nlabelsp is the number of common significant labels.
The promise "nlabelsp is the number of common significant labels" is not
fulfilled in this case:
if (name1 == name2) {
*orderp = 0;
return (dns_namereln_equal);
}
Have a nice day!
--
Petr Spacek @ Red Hat