Skip to content

Commit 87258eb

Browse files
authored
ext/phar: Fix path overread from recent refactoring (#21943)
This is from unrelased refactoring: e1c5049#diff-04979daf330cd412502ec8ebf4a363d608a73f034687a0dd07328fd0969f2813L2070-R2069 . It was a clear mistake that can lead to the over-read.
1 parent e228395 commit 87258eb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ext/phar/phar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ zend_string* phar_fix_filepath(const char *path, size_t path_length, bool use_cw
20742074
size_t ptr_length;
20752075

20762076
if (use_cwd && PHAR_G(cwd_len) && path_length > 2 && path[0] == '.' && path[1] == '/') {
2077-
new_path = zend_string_alloc(path_length + path_length + 1, false);
2077+
new_path = zend_string_alloc(path_length + PHAR_G(cwd_len) + 1, false);
20782078
new_path_len = PHAR_G(cwd_len);
20792079
memcpy(ZSTR_VAL(new_path), PHAR_G(cwd), PHAR_G(cwd_len));
20802080
} else {

0 commit comments

Comments
 (0)