]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #27559 (Corrected open_basedir resolving logic).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 16 Mar 2004 00:32:09 +0000 (00:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 16 Mar 2004 00:32:09 +0000 (00:32 +0000)
NEWS
main/fopen_wrappers.c

diff --git a/NEWS b/NEWS
index 30ad7ae766e5d0b7482d80f8bc5353ebf36c1a24..01c4223a66276b08d8619d58ba2bf2c58eebabfd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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)
index ad3e4f9cc72c1b194a71dba7953f1f29dc2a70d4..d75ae26e2e061905f1ca5a66436b179c8001f701 100644 (file)
@@ -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) {