2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

4467. [security] It was possible to trigger a assertion when rendering

a message. [RT #43139]
This commit is contained in:
Mark Andrews 2016-09-09 11:29:48 +10:00
parent 61ca100b80
commit 2bd0922cf9
2 changed files with 34 additions and 11 deletions

View File

@ -1,3 +1,6 @@
4467. [security] It was possible to trigger a assertion when rendering
a message. [RT #43139]
4466. [bug] Interface scanning didn't work on a Windows system 4466. [bug] Interface scanning didn't work on a Windows system
without a non local IPv6 addresses. [RT #43130] without a non local IPv6 addresses. [RT #43130]

View File

@ -1720,7 +1720,7 @@ dns_message_renderbegin(dns_message_t *msg, dns_compress_t *cctx,
if (r.length < DNS_MESSAGE_HEADERLEN) if (r.length < DNS_MESSAGE_HEADERLEN)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (r.length < msg->reserved) if (r.length - DNS_MESSAGE_HEADERLEN < msg->reserved)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
/* /*
@ -1861,8 +1861,29 @@ norender_rdataset(const dns_rdataset_t *rdataset, unsigned int options,
return (ISC_TRUE); return (ISC_TRUE);
} }
#endif #endif
static isc_result_t
renderset(dns_rdataset_t *rdataset, dns_name_t *owner_name,
dns_compress_t *cctx, isc_buffer_t *target,
unsigned int reserved, unsigned int options, unsigned int *countp)
{
isc_result_t result;
/*
* Shrink the space in the buffer by the reserved amount.
*/
if (target->length - target->used < reserved)
return (ISC_R_NOSPACE);
target->length -= reserved;
result = dns_rdataset_towire(rdataset, owner_name,
cctx, target, options, countp);
target->length += reserved;
return (result);
}
isc_result_t isc_result_t
dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
unsigned int options) unsigned int options)
@ -1905,6 +1926,8 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
/* /*
* Shrink the space in the buffer by the reserved amount. * Shrink the space in the buffer by the reserved amount.
*/ */
if (msg->buffer->length - msg->buffer->used < msg->reserved)
return (ISC_R_NOSPACE);
msg->buffer->length -= msg->reserved; msg->buffer->length -= msg->reserved;
total = 0; total = 0;
@ -2180,9 +2203,8 @@ dns_message_renderend(dns_message_t *msg) {
* Render. * Render.
*/ */
count = 0; count = 0;
result = dns_rdataset_towire(msg->opt, dns_rootname, result = renderset(msg->opt, dns_rootname, msg->cctx,
msg->cctx, msg->buffer, 0, msg->buffer, msg->reserved, 0, &count);
&count);
msg->counts[DNS_SECTION_ADDITIONAL] += count; msg->counts[DNS_SECTION_ADDITIONAL] += count;
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@ -2198,9 +2220,8 @@ dns_message_renderend(dns_message_t *msg) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
count = 0; count = 0;
result = dns_rdataset_towire(msg->tsig, msg->tsigname, result = renderset(msg->tsig, msg->tsigname, msg->cctx,
msg->cctx, msg->buffer, 0, msg->buffer, msg->reserved, 0, &count);
&count);
msg->counts[DNS_SECTION_ADDITIONAL] += count; msg->counts[DNS_SECTION_ADDITIONAL] += count;
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@ -2221,9 +2242,8 @@ dns_message_renderend(dns_message_t *msg) {
* the owner name of a SIG(0) is irrelevant, and will not * the owner name of a SIG(0) is irrelevant, and will not
* be set in a message being rendered. * be set in a message being rendered.
*/ */
result = dns_rdataset_towire(msg->sig0, dns_rootname, result = renderset(msg->sig0, dns_rootname, msg->cctx,
msg->cctx, msg->buffer, 0, msg->buffer, msg->reserved, 0, &count);
&count);
msg->counts[DNS_SECTION_ADDITIONAL] += count; msg->counts[DNS_SECTION_ADDITIONAL] += count;
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);