diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-03-16 00:32:09 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-03-16 00:32:09 +0000 |
commit | 8cf790dea18ac4eeb532054953f23782780c9883 (patch) | |
tree | 918a01e24a1c07189c7e3a5012637b307137dfdc | |
parent | e58b48e89c30ddebc3f714580f4009d8039691d6 (diff) | |
download | php-git-8cf790dea18ac4eeb532054953f23782780c9883.tar.gz |
MFH: Fixed bug #27559 (Corrected open_basedir resolving logic).
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | main/fopen_wrappers.c | 10 |
2 files changed, 7 insertions, 4 deletions
@@ -11,6 +11,7 @@ PHP 4 NEWS - Fixed bug #27590 (crash during shutdown when freeing persistent resources in ZTS mode). (Ilia) - Fixed bug #27582 (possible crashes in imagefilltoborder()). (Pierre) +- Fixed bug #27559 (Corrected open_basedir resolving logic). (Ilia) - Fixed bug #27530 (broken http auth when safe_mode is on and PCRE is disabled). (Ilia) - Fixed bug #27509 (broken getaddrinfo() causes fsockopen() error). (Sara) diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index ad3e4f9cc7..d75ae26e2e 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -132,11 +132,13 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path if ((expand_filepath(path, resolved_name TSRMLS_CC) != NULL) && (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL)) { /* Handler for basedirs that end with a / */ resolved_basedir_len = strlen(resolved_basedir); - if (resolved_basedir[resolved_basedir_len -1] != PHP_DIR_SEPARATOR) { - resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR; - resolved_basedir[++resolved_basedir_len] = '\0'; + if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) { + if (resolved_basedir[resolved_basedir_len - 1] == '/') { + resolved_basedir[resolved_basedir_len - 1] = PHP_DIR_SEPARATOR; + resolved_basedir[++resolved_basedir_len] = '\0'; + } } - + if (path[strlen(path)-1] == PHP_DIR_SEPARATOR) { resolved_name_len = strlen(resolved_name); if (resolved_name[resolved_name_len - 1] != PHP_DIR_SEPARATOR) { |