Skip to content

Commit af8fcce

Browse files
committed
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.
1 parent a9661a5 commit af8fcce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Zend/zend_smart_str.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len)
4545
ZEND_API void ZEND_FASTCALL smart_str_realloc(smart_str *str, size_t len)
4646
{
4747
if (UNEXPECTED(!str->s)) {
48-
str->a = len <= SMART_STR_START_SIZE
48+
str->a = len <= SMART_STR_START_LEN
4949
? SMART_STR_START_LEN
5050
: SMART_STR_NEW_LEN(len);
5151
str->s = zend_string_alloc(str->a, 1);

0 commit comments

Comments
 (0)