Skip to content

Commit 40b3f88

Browse files
authored
phar: Avoid string duplication just for error message, use truncation formatting string (#20229)
1 parent 45a50d0 commit 40b3f88

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,10 +4315,7 @@ PHP_METHOD(Phar, extractTo)
43154315
}
43164316

43174317
if (ZSTR_LEN(path_to) >= MAXPATHLEN) {
4318-
char *tmp = estrndup(ZSTR_VAL(path_to), 50);
4319-
/* truncate for error message */
4320-
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Cannot extract to \"%s...\", destination directory is too long for filesystem", tmp);
4321-
efree(tmp);
4318+
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Cannot extract to \"%.50s...\", destination directory is too long for filesystem", ZSTR_VAL(path_to));
43224319
RETURN_THROWS();
43234320
}
43244321

0 commit comments

Comments
 (0)