From: Arnaud Le Blanc Date: Mon, 18 Aug 2008 03:54:49 +0000 (+0000) Subject: update buffer size after having effectively realloc()ed it when appending X-Git-Tag: BEFORE_HEAD_NS_CHANGE~673 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e94a9d25f2ffeadd7472dbb78d0d39300da8471;p=php update buffer size after having effectively realloc()ed it when appending data to an output buffer # may caused some problems if erealloc() failed here because of memory # limit ("memory limit exhausted" error message then written to # the buffer, etc) --- diff --git a/main/output.c b/main/output.c index b4067c41a6..5a2b8641d3 100644 --- a/main/output.c +++ b/main/output.c @@ -913,7 +913,8 @@ static inline int php_output_handler_append(php_output_handler *handler, const p size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); size_t grow_max = MAX(grow_int, grow_buf); - handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size += grow_max); + handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max); + handler->buffer.size += grow_max; } memcpy(handler->buffer.data + handler->buffer.used, buf->data, buf->used); handler->buffer.used += buf->used;