diff options
| author | Steph Fox <sfox@php.net> | 2008-07-07 01:11:07 +0000 |
|---|---|---|
| committer | Steph Fox <sfox@php.net> | 2008-07-07 01:11:07 +0000 |
| commit | 2c9df0990d16a466f4234b6e4b9048b748cb1478 (patch) | |
| tree | d608e0f796369924ec82144e1527f0344b9bf9a8 /ext/phar/phar_object.c | |
| parent | 5db08e7d1f6d3af3222cf849c356ac2c1cb3f7d0 (diff) | |
| download | php-git-2c9df0990d16a466f4234b6e4b9048b748cb1478.tar.gz | |
- We forgot to check that the phar exists before trying to extract files from it :)
Diffstat (limited to 'ext/phar/phar_object.c')
| -rwxr-xr-x | ext/phar/phar_object.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 6e7b3e0bc4..6723a9dacc 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -3868,9 +3868,10 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char * PHP_METHOD(Phar, extractTo) { char *error = NULL; + php_stream *fp; php_stream_statbuf ssb; phar_entry_info *entry; - char *pathto, *filename; + char *pathto, *filename, *actual; int pathto_len, filename_len; int ret, i; int nelems; @@ -3882,6 +3883,15 @@ PHP_METHOD(Phar, extractTo) return; } + fp = php_stream_open_wrapper(phar_obj->arc.archive->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK, &actual); + efree(actual); + if (!fp) { + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, + "Invalid argument, %s cannot be found", phar_obj->arc.archive->fname); + return; + } + php_stream_close(fp); + if (pathto_len < 1) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Invalid argument, extraction path must be non-zero length"); |
