From: Rasmus Lerdorf Date: Sat, 11 May 2002 19:23:05 +0000 (+0000) Subject: MFH - parse_ini_file() safe-mode fix X-Git-Tag: php-4.2.1~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d7369972164f6a6c4df27b77d9a668efe29a85d;p=php MFH - parse_ini_file() safe-mode fix --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 26aef54e7b..9376d834d0 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2501,6 +2501,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));