From 15383e046e27d211d8ac2d78719eb039ec968e9b Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 27 Jul 2011 14:58:30 +0000 Subject: [PATCH] - do safemode/open basedir checks 1st, and use only expand not realpath (it is done by the safemode/openbasedir check already) --- ext/fileinfo/fileinfo.c | 8 ++++---- 1 file 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)); -- 2.50.1