From c3e95f11e02c51fc786b9124c817ab72dda3084c Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Thu, 19 Aug 1999 17:56:35 +0000 Subject: [PATCH] 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. --- lib/dns/name.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/dns/name.c b/lib/dns/name.c index 60b6b90169..fcc3a3943b 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -1315,6 +1315,12 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, if (tbcount == 0) return (DNS_R_BADBITSTRING); + if (count > 0) { + n1 = count % 8; + if (n1 != 0) + value <<= (8 - n1); + } + if (bitlength != 0) { if (bitlength > tbcount) return (DNS_R_BADBITSTRING); @@ -1412,9 +1418,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, bitlength = tbcount; if (count > 0) { - n1 = count % 8; - if (n1 != 0) - value <<= (8 - n1); *ndata++ = value; nrem--; nused++;