From: Pierre Joye Date: Wed, 27 Jul 2011 14:58:30 +0000 (+0000) Subject: - do safemode/open basedir checks 1st, and use only expand not realpath (it is done... X-Git-Tag: php-5.4.0alpha3~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15383e046e27d211d8ac2d78719eb039ec968e9b;p=php - do safemode/open basedir checks 1st, and use only expand not realpath (it is done by the safemode/openbasedir check already) --- 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));