Commit c3e95f11 authored by Bob Halley's avatar Bob Halley
Browse files

The bits in the last byte of a bitstring being constructed in _fromtext()

were not always shifted into the correct positions.  This would cause
an error when certain valid bitstrings, e.g. "\[xA/4].", were parsed.
parent 77a3409a
...@@ -1315,6 +1315,12 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, ...@@ -1315,6 +1315,12 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
if (tbcount == 0) if (tbcount == 0)
return (DNS_R_BADBITSTRING); return (DNS_R_BADBITSTRING);
if (count > 0) {
n1 = count % 8;
if (n1 != 0)
value <<= (8 - n1);
}
if (bitlength != 0) { if (bitlength != 0) {
if (bitlength > tbcount) if (bitlength > tbcount)
return (DNS_R_BADBITSTRING); return (DNS_R_BADBITSTRING);
...@@ -1412,9 +1418,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, ...@@ -1412,9 +1418,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
bitlength = tbcount; bitlength = tbcount;
if (count > 0) { if (count > 0) {
n1 = count % 8;
if (n1 != 0)
value <<= (8 - n1);
*ndata++ = value; *ndata++ = value;
nrem--; nrem--;
nused++; nused++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment