]> granicus.if.org Git - php/commitdiff
Another safe-mode fix. parse_ini_file() did not check
authorRasmus Lerdorf <rasmus@php.net>
Sat, 11 May 2002 19:19:49 +0000 (19:19 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sat, 11 May 2002 19:19:49 +0000 (19:19 +0000)
@ safe-mode fix for parse_ini_file()  (Rasmus)

ext/standard/basic_functions.c

index 27452efa196bc224bed35004939e759fdfe567c0..be97f013732a567527d1d97f482757fc4659aece 100644 (file)
@@ -2471,6 +2471,15 @@ PHP_FUNCTION(parse_ini_file)
        }
 
        convert_to_string_ex(filename);
+
+       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
+               RETURN_FALSE;
+       }
+
+       if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
+               RETURN_FALSE;
+       }
+
        fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
        if (!fh.handle.fp) {
                php_error(E_WARNING, "Cannot open '%s' for reading", Z_STRVAL_PP(filename));