mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 15:45:25 +00:00
Forbid isc_buffer_printf from growing the buffer unless auto reallocation is enabled
This commit is contained in:
@@ -662,10 +662,16 @@ isc_buffer_printf(isc_buffer_t *b, const char *format, ...) {
|
|||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ISC_UNLIKELY(b->autore)) {
|
||||||
result = isc_buffer_reserve(&b, n + 1);
|
result = isc_buffer_reserve(&b, n + 1);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isc_buffer_availablelength(b) < (unsigned int)n + 1) {
|
||||||
|
return (ISC_R_NOSPACE);
|
||||||
|
}
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
n = vsnprintf(isc_buffer_used(b), n + 1, format, ap);
|
n = vsnprintf(isc_buffer_used(b), n + 1, format, ap);
|
||||||
|
Reference in New Issue
Block a user