519. [bug] dns_name_split() would improperly split some bitstring

labels, zeroing a few of the least signficant bits in
			the prefix part.  When such an improperly created
			prefix was returned to the RBT database, the bogus
			label was dutifully stored, corrupting the tree.
			[RT #369]

Also made dns_name_split() REQUIRE that suffixlabels always be greater than 0,
even when splitting a bitstring label (it already required this when not
splitting a bitstring label).  This is consistent with the way dns_name_split()
was called to split a name that consisted of a single label, a bitstring;
the appropriate suffixlabels value is 1 in such cases.

Also a fixed minor style error, and a confusing comment.
This commit is contained in:
David Lawrence
2000-10-14 04:31:31 +00:00
parent 1417088e3c
commit 190fbe9738
2 changed files with 18 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
519. [bug] dns_name_split() would improperly split some bitstring
labels, zeroing a few of the least signficant bits in
the prefix part. When such an improperly created
prefix was returned to the RBT database, the bogus
label was dutifully stored, corrupting the tree.
[RT #369]
518. [bug] The resolver did not realize that a DNAME which was
"the answer" to the client's query was "the answer",
and such queries would fail. [RT #399]

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.c,v 1.104 2000/10/11 17:44:12 mws Exp $ */
/* $Id: name.c,v 1.105 2000/10/14 04:31:31 tale Exp $ */
#include <config.h>
@@ -2741,6 +2741,15 @@ dns_name_split(dns_name_t *name,
memcpy(dst, src, len);
} else {
/*
* p is adjusted to point to the last byte of
* the starting bitstring label to make it
* cheap to determine when bits from the next
* byte should be shifted into the low order
* bits of the current byte.
*/
p = src + (mod + *p - 1) / 8;
while (len--) {
*dst = *src++ << mod;
/*
@@ -2748,7 +2757,7 @@ dns_name_split(dns_name_t *name,
* against arithmetic sign extension
* by the right shift.
*/
if (len > 0)
if (src <= p)
*dst++ |=
(*src >> (8 - mod)) &
~(0xFF << mod);