diff options
author | Anatol Belski <ab@php.net> | 2013-04-10 20:45:28 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2013-04-10 20:45:28 +0200 |
commit | 0655ab7c261840d8068c7360af5cda5351cffc22 (patch) | |
tree | 76b8b6c80bf8e3614eea4e08697e2d76d3e26958 /ext/zip/php_zip.c | |
parent | af967de2afc584c602c0b6d4d6731e411323d94e (diff) | |
parent | 782085bbfbb6fff07c59b3528285bc619ee5847b (diff) | |
download | php-git-0655ab7c261840d8068c7360af5cda5351cffc22.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
updated NEWS
Fixed bug #64342 ZipArchive::addFile() has to check for file existence
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 66479d7bf7..37a0cdea19 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -28,6 +28,7 @@ #include "ext/standard/file.h" #include "ext/standard/php_string.h" #include "ext/pcre/php_pcre.h" +#include "ext/standard/php_filestat.h" #include "php_zip.h" #include "lib/zip.h" #include "lib/zipint.h" @@ -300,6 +301,7 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam struct zip_source *zs; int cur_idx; char resolved_path[MAXPATHLEN]; + zval exists_flag; if (ZIP_OPENBASEDIR_CHECKPATH(filename)) { @@ -310,6 +312,11 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam return -1; } + php_stat(resolved_path, strlen(resolved_path), FS_EXISTS, &exists_flag TSRMLS_CC); + if (!Z_BVAL(exists_flag)) { + return -1; + } + zs = zip_source_file(za, resolved_path, offset_start, offset_len); if (!zs) { return -1; |