From: Greg Beaver Date: Sun, 11 May 2008 22:45:03 +0000 (+0000) Subject: don't copy contents of linked/mounted files when converting an archive, and be sure... X-Git-Tag: RELEASE_2_0_0b1~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad1be25d8c047fca31df6ffddbe9b904894ecf17;p=php don't copy contents of linked/mounted files when converting an archive, and be sure to dupe mounted value --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 8c5bfb12cc..3b5ae23e0d 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1959,6 +1959,11 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char newentry = *entry; if (newentry.link) { newentry.link = estrdup(newentry.link); + goto no_copy; + } + if (newentry.tmp) { + newentry.tmp = estrdup(newentry.tmp); + goto no_copy; } if (FAILURE == phar_copy_file_contents(&newentry, phar->fp TSRMLS_CC)) { zend_hash_destroy(&(phar->manifest)); @@ -1967,6 +1972,7 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char /* exception already thrown */ return NULL; } +no_copy: newentry.filename = estrndup(newentry.filename, newentry.filename_len); if (newentry.metadata) { zval *t; diff --git a/ext/phar/tests/phar_mount.phpt b/ext/phar/tests/phar_mount.phpt index 90386ffd09..4578b3a33d 100644 --- a/ext/phar/tests/phar_mount.phpt +++ b/ext/phar/tests/phar_mount.phpt @@ -6,8 +6,9 @@ Phar: Phar::mount phar.readonly=0 --FILE-- convertToExecutable(Phar::TAR); +$b->setStub('getMessage(),"\n"; +} ?> ===DONE=== --CLEAN-- - + + --EXPECTF-- -Mounting of testit to %sphar_mount.php within phar %stempmanifest1.phar.php failed -Can only mount internal paths within a phar archive, use a relative path instead of "phar://%stempmanifest1.phar.php/testit1" +Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.php failed +Can only mount internal paths within a phar archive, use a relative path instead of "phar://%sphar_mount.phar.php/testit1" +Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.tar failed ===DONE=== \ No newline at end of file