summaryrefslogtreecommitdiff
path: root/ext/standard/file.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-05-27 17:33:39 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-05-27 17:33:39 +0000
commit6f61e8472780eae3ddcb566baefba0538ea53059 (patch)
treeb6833f9133b13a93432a1259f0f043b1f7ae0cd0 /ext/standard/file.c
parentd2ec6b60da260fa0061340645aa80ec77b6234e4 (diff)
downloadphp-git-6f61e8472780eae3ddcb566baefba0538ea53059.tar.gz
Fixed bug #41492 (open_basedir/safe_mode bypass inside realpath()).
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r--ext/standard/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 870972b366..e6dd5d71a4 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -2371,6 +2371,14 @@ PHP_FUNCTION(realpath)
convert_to_string_ex(path);
if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
+ if (PG(safe_mode) && (!php_checkuid(resolved_path_buff, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(resolved_path_buff TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
#ifdef ZTS
if (VCWD_ACCESS(resolved_path_buff, F_OK)) {
RETURN_FALSE;