From 57cf89b149a6c4a9794c24613f9b765e02a54b2f Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 30 Jul 1999 13:33:14 +0000 Subject: [PATCH] set msg->rdclass even if question section is empty --- lib/dns/message.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/dns/message.c b/lib/dns/message.c index b1b9a564fe..819bdfd00b 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -923,6 +923,17 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, rdtype = isc_buffer_getuint16(source); rdclass = isc_buffer_getuint16(source); + /* + * If there was no question section, we may not yet have + * established a class. Do so now. + */ + if (msg->state == DNS_SECTION_ANY) { + if (rdclass == 0 || rdclass == dns_rdataclass_any) + return (DNS_R_FORMERR); + msg->rdclass = rdclass; + msg->state = DNS_SECTION_QUESTION; + } + /* * If this class is different than the one in the question * section, bail.