1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix persistent smart_str allocation

This would allocate a too small buffer if the first smart_str
allocation is > SMART_STR_START_LEN but <= SMART_STR_START_SIZE.
This commit is contained in:
Nikita Popov
2021-09-16 16:07:09 +02:00
parent a9661a5293
commit af8fccee9c

View File

@@ -45,7 +45,7 @@ ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len)
ZEND_API void ZEND_FASTCALL smart_str_realloc(smart_str *str, size_t len)
{
if (UNEXPECTED(!str->s)) {
str->a = len <= SMART_STR_START_SIZE
str->a = len <= SMART_STR_START_LEN
? SMART_STR_START_LEN
: SMART_STR_NEW_LEN(len);
str->s = zend_string_alloc(str->a, 1);