mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix leak in phar open
This commit is contained in:
parent
96c84b7bc1
commit
46561dab6a
2 changed files with 8 additions and 7 deletions
|
@ -1386,6 +1386,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
|
|||
mydata = ecalloc(1, sizeof(phar_archive_data));
|
||||
mydata->fname = expand_filepath(fname, NULL);
|
||||
if (mydata->fname == NULL) {
|
||||
efree(mydata);
|
||||
return FAILURE;
|
||||
}
|
||||
fname_len = strlen(mydata->fname);
|
||||
|
|
|
@ -5,11 +5,11 @@ Bug #77396 Relative filename exceeding maximum path length causes null pointer d
|
|||
--FILE--
|
||||
<?php
|
||||
$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar';
|
||||
$phar = new PharData($path);
|
||||
try {
|
||||
$phar = new PharData($path);
|
||||
} catch (UnexpectedValueException $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s%ebug77396.php:%d
|
||||
Stack trace:
|
||||
#0 %s%ebug77396.php(%d): PharData->__construct(%s)
|
||||
#1 {main}
|
||||
thrown in %s%ebug77396.php on line %d
|
||||
--EXPECT--
|
||||
Phar creation or opening failed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue