summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2013-04-10 20:47:55 +0200
committerAnatol Belski <ab@php.net>2013-04-10 20:47:55 +0200
commit9386ba9e97fc935c6a120670b333843c20033882 (patch)
treeb153901ae71f71aee11ee0b4407f2fe7bb8c6b6a /ext/zip/php_zip.c
parentfd15a711841e6cd86e59c43ca85eea169e1c7ec5 (diff)
parentfc658f442da3efc77bc811a4976ab3465e758959 (diff)
downloadphp-git-9386ba9e97fc935c6a120670b333843c20033882.tar.gz
Merge branch 'PHP-5.5'
* PHP-5.5: update NEWS 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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 872affeb4d..b73082ba71 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;