From: Nikita Popov Date: Thu, 20 Jul 2017 19:14:01 +0000 (+0200) Subject: Only write single terminating byte X-Git-Tag: php-7.3.0alpha1~1862 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a319063aaeaad817cd777a373c5b8ac6a26950d1;p=php Only write single terminating byte As far as I could determine this is sufficient. It avoids reallocating the buffer, if it was perfectly allocated beforehand. --- diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c index 5a28613014..176a752288 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c @@ -119,7 +119,7 @@ mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result) { if (device && result) { result->len = device->pos; - mbfl_memory_device_output4('\0', device); + mbfl_memory_device_output('\0', device); result->val = device->buffer; device->buffer = (unsigned char *)0; device->length = 0;