summaryrefslogtreecommitdiff
path: root/main/fopen_wrappers.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-06-01 13:35:23 +0000
committerAntony Dovgal <tony2001@php.net>2007-06-01 13:35:23 +0000
commit8e3eee385e177923f313aa6dbaa02b00e8341955 (patch)
treea255477cc73131caa265ef11ae67e96339b92bf4 /main/fopen_wrappers.c
parent6d76fc283405217496e52bd7627c85a849328d08 (diff)
downloadphp-git-8e3eee385e177923f313aa6dbaa02b00e8341955.tar.gz
MFH: fix #41518 (file_exists() warns of open_basedir restriction on non-existent file)
Diffstat (limited to 'main/fopen_wrappers.c')
-rw-r--r--main/fopen_wrappers.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 88003527b5..c27a60f128 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -172,8 +172,8 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
}
}
+ resolved_name_len = strlen(resolved_name);
if (path_tmp[path_len - 1] == PHP_DIR_SEPARATOR) {
- resolved_name_len = strlen(resolved_name);
if (resolved_name[resolved_name_len - 1] != PHP_DIR_SEPARATOR) {
resolved_name[resolved_name_len] = PHP_DIR_SEPARATOR;
resolved_name[++resolved_name_len] = '\0';
@@ -189,6 +189,16 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
/* File is in the right directory */
return 0;
} else {
+ /* /openbasedir/ and /openbasedir are the same directory */
+ if (resolved_basedir_len == (resolved_name_len + 1) && resolved_basedir[resolved_basedir_len - 1] == PHP_DIR_SEPARATOR) {
+#if defined(PHP_WIN32) || defined(NETWARE)
+ if (strncasecmp(resolved_basedir, resolved_name, resolved_name_len) == 0) {
+#else
+ if (strncmp(resolved_basedir, resolved_name, resolved_name_len) == 0) {
+#endif
+ return 0;
+ }
+ }
return -1;
}
} else {