diff --git a/CHANGES b/CHANGES index ad1cf8c311..542886b6c7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3861. [security] Missing isc_buffer_availablelength check results + in a REQUIRE assertion when printing out a packet. + [RT #36078] + 3860. [bug] ioctl(DP_POLL) array size needs to be determined at run time as it is limited to {OPEN_MAX}. [RT #35878] diff --git a/lib/dns/message.c b/lib/dns/message.c index b7ffa956dd..d76eb4fb26 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -3206,7 +3206,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, - isc_buffer_t *target) { + isc_buffer_t *target) +{ dns_rdataset_t *ps = NULL; dns_name_t *name = NULL; isc_result_t result; @@ -3280,8 +3281,11 @@ dns_message_pseudosectiontotext(dns_message_t *msg, sprintf(buf, "%02x ", optdata[i]); ADD_STRING(target, buf); } + for (i = 0; i < optlen; i++) { ADD_STRING(target, " ("); + if (!isc_buffer_availablelength(target)) + return (ISC_R_NOSPACE); if (isprint(optdata[i])) isc_buffer_putmem(target, &optdata[i],