Skip to content

Commit 4c9bbaa

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: streams/memory: Ensure internal string is NUL terminated (#20812)
2 parents 971728f + de1465e commit 4c9bbaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/streams/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
247247
size_t old_size = ZSTR_LEN(ms->data);
248248
ms->data = zend_string_realloc(ms->data, newsize, 0);
249249
memset(ZSTR_VAL(ms->data) + old_size, 0, newsize - old_size);
250-
ZSTR_VAL(ms->data)[ZSTR_LEN(ms->data)] = '\0';
251250
}
251+
ZSTR_VAL(ms->data)[ZSTR_LEN(ms->data)] = '\0';
252252
return PHP_STREAM_OPTION_RETURN_OK;
253253
}
254254
}

0 commit comments

Comments
 (0)