diff options
author | Brian France <bfrance@php.net> | 2002-10-04 22:16:16 +0000 |
---|---|---|
committer | Brian France <bfrance@php.net> | 2002-10-04 22:16:16 +0000 |
commit | 3340e82508ee3cb7a3fabd4b2cd5eaeb5d75b8fe (patch) | |
tree | 16cc7687a597c8679637da2338219287fd3cba59 | |
parent | 87c0577a0c250f45ddf40bb5a663c04d71847adc (diff) | |
download | php-git-3340e82508ee3cb7a3fabd4b2cd5eaeb5d75b8fe.tar.gz |
Fixed a problem where opendir with <path>/ and having <path>/ in
open_basedir ini option didn't work. It was removing the trailing
slashes and then addeding it back to only one of the string,
now it adds it back to to both if needed.
-rw-r--r-- | main/fopen_wrappers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 72b8e0a7bc..b5abebbca3 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -108,6 +108,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path char local_open_basedir[MAXPATHLEN]; int local_open_basedir_pos; int resolved_basedir_len; + int resolved_name_len; /* Special case basedir==".": Use script-directory */ if ((strcmp(basedir, ".") == 0) && @@ -138,6 +139,12 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path resolved_basedir_len = strlen(resolved_basedir); } + if (path[strlen(path)-1] == PHP_DIR_SEPARATOR) { + resolved_name_len = strlen(resolved_name); + resolved_name[resolved_name_len] = '/'; + resolved_name[++resolved_name_len] = '\0'; + } + /* Check the path */ #ifdef PHP_WIN32 if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) { |