mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
4615. [bug] AD could be set on truncated answer with no records
present in the answer and authority sections. [RT #45140]
This commit is contained in:
@@ -1960,6 +1960,15 @@ renderset(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_clear_ad(dns_message_t *msg, dns_section_t sectionid) {
|
||||
if (msg->counts[sectionid] == 0 &&
|
||||
(sectionid == DNS_SECTION_ANSWER ||
|
||||
(sectionid == DNS_SECTION_AUTHORITY &&
|
||||
msg->counts[DNS_SECTION_ANSWER] == 0)))
|
||||
msg->flags &= ~DNS_MESSAGEFLAG_AD;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
unsigned int options)
|
||||
@@ -2157,6 +2166,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
*(msg->buffer) = st; /* rollback */
|
||||
msg->buffer->length += msg->reserved;
|
||||
msg->counts[sectionid] += total;
|
||||
maybe_clear_ad(msg, sectionid);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user