From 31efcf64783b32a97a7dd60169375edb7d580376 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Tue, 13 Feb 2001 00:07:25 +0000 Subject: [PATCH] Build the offsets table in dns_name_fromwire() while parsing the name, not by calling set_offsets. --- lib/dns/name.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/dns/name.c b/lib/dns/name.c index e9693db84d..bdcbb94af3 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.120 2001/02/12 18:07:49 bwelling Exp $ */ +/* $Id: name.c,v 1.121 2001/02/13 00:07:25 bwelling Exp $ */ #include @@ -2232,6 +2232,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, switch (state) { case fw_start: if (c < 64) { + offsets[labels] = nused; labels++; if (nused + c + 1 > nmax) goto full; @@ -2259,6 +2260,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, n = 1; state = fw_newcurrent; } else if (c == DNS_LABELTYPE_BITSTRING) { + offsets[labels] = nused; labels++; if (nused == nmax) goto full; @@ -2324,12 +2326,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, name->length = nused; name->attributes |= DNS_NAMEATTR_ABSOLUTE; - /* - * We should build the offsets table directly. - */ - if (name->offsets != NULL || saw_bitstring) - set_offsets(name, offsets, NULL); - if (saw_bitstring) compact(name, offsets);