summaryrefslogtreecommitdiff
path: root/ext/zip/zip_stream.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-03-14 03:50:18 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-03-14 03:50:18 +0000
commit6d70aa1f4e99d0ff8f9c334a9c0ce07a69cb26a3 (patch)
treee6ca720714f77c5640d861d0f4bfcc756697dfca /ext/zip/zip_stream.c
parentc3e4a2854a1eb075c2d059ec69b9e3a83a49cd20 (diff)
downloadphp-git-6d70aa1f4e99d0ff8f9c334a9c0ce07a69cb26a3.tar.gz
Added missing open_basedir & safe_mode checks to zip:// and bzip://
wrappers. Issues idendtified by MOPB-20 and MOPB-21
Diffstat (limited to 'ext/zip/zip_stream.c')
-rw-r--r--ext/zip/zip_stream.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index c36df3e4c0..d4b511cc09 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.c
@@ -112,6 +112,10 @@ php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_D
}
if (filename) {
+ if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
+ return NULL;
+ }
+
/* duplicate to make the stream za independent (esp. for MSHUTDOWN) */
stream_za = zip_open(filename, ZIP_CREATE, &err);
if (!stream_za) {
@@ -189,6 +193,11 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
php_basename(path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC);
fragment++;
+ if ((PG(safe_mode) && (!php_checkuid(file_dirname, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file_dirname TSRMLS_CC)) {
+ efree(file_basename);
+ return NULL;
+ }
+
za = zip_open(file_dirname, ZIP_CREATE, &err);
if (za) {
zf = zip_fopen(za, fragment, 0);