Skip to content

Commit 2d73699

Browse files
committed
MFH - parse_ini_file() safe-mode fix
1 parent 4caca1d commit 2d73699

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,6 +2501,15 @@ PHP_FUNCTION(parse_ini_file)
25012501
}
25022502

25032503
convert_to_string_ex(filename);
2504+
2505+
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
2506+
RETURN_FALSE;
2507+
}
2508+
2509+
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
2510+
RETURN_FALSE;
2511+
}
2512+
25042513
fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
25052514
if (!fh.handle.fp) {
25062515
php_error(E_WARNING, "Cannot open '%s' for reading", Z_STRVAL_PP(filename));

0 commit comments

Comments
 (0)