]> granicus.if.org Git - php/commitdiff
- do safemode/open basedir checks 1st, and use only expand not realpath (it is done...
authorPierre Joye <pajoye@php.net>
Wed, 27 Jul 2011 14:58:30 +0000 (14:58 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 27 Jul 2011 14:58:30 +0000 (14:58 +0000)
ext/fileinfo/fileinfo.c

index 3376c5d69bf33084ce4aa52889ac76f09f96f753..6d8525c557d19ef54178ba6fd645720ac14a8de6 100644 (file)
@@ -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));