summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-07-27 14:58:30 +0000
committerPierre Joye <pajoye@php.net>2011-07-27 14:58:30 +0000
commit15383e046e27d211d8ac2d78719eb039ec968e9b (patch)
tree597b533b26fea0739bcc076aa0a85433e05c5a87
parentef7229ed177abf629b7106a6adaf9e80147f438f (diff)
downloadphp-git-15383e046e27d211d8ac2d78719eb039ec968e9b.tar.gz
- do safemode/open basedir checks 1st, and use only expand not realpath (it is done by the safemode/openbasedir check already)
-rw-r--r--ext/fileinfo/fileinfo.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 3376c5d69b..6d8525c557 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -293,10 +293,6 @@ PHP_FUNCTION(finfo_open)
if (file_len == 0) {
file = NULL;
} else if (file && *file) { /* user specified file, perform open_basedir checks */
- if (!VCWD_REALPATH(file, resolved_path)) {
- RETURN_FALSE;
- }
- file = resolved_path;
#if PHP_API_VERSION < 20100412
if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
@@ -305,6 +301,10 @@ PHP_FUNCTION(finfo_open)
#endif
RETURN_FALSE;
}
+ if (!expand_filepath_with_mode(file, resolved_path, NULL, 0, CWD_EXPAND TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ file = resolved_path;
}
finfo = emalloc(sizeof(struct php_fileinfo));