2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Forbid isc_buffer_printf from growing the buffer unless auto reallocation is enabled

This commit is contained in:
Ondřej Surý
2018-07-27 11:22:47 +02:00
parent 6a6dc2f410
commit 519bfe4c97

View File

@@ -662,9 +662,15 @@ isc_buffer_printf(isc_buffer_t *b, const char *format, ...) {
return (ISC_R_FAILURE);
}
result = isc_buffer_reserve(&b, n + 1);
if (result != ISC_R_SUCCESS) {
return (result);
if (ISC_UNLIKELY(b->autore)) {
result = isc_buffer_reserve(&b, n + 1);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (isc_buffer_availablelength(b) < (unsigned int)n + 1) {
return (ISC_R_NOSPACE);
}
va_start(ap, format);