iliaa           Mon Mar 15 19:31:23 2004 EDT

  Modified files:              
    /php-src/main       fopen_wrappers.c 
  Log:
  Fixed bug #27559 (Corrected open_basedir resolving logic).
  
  
http://cvs.php.net/diff.php/php-src/main/fopen_wrappers.c?r1=1.169&r2=1.170&ty=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.169 php-src/main/fopen_wrappers.c:1.170
--- php-src/main/fopen_wrappers.c:1.169 Tue Feb 10 11:08:54 2004
+++ php-src/main/fopen_wrappers.c       Mon Mar 15 19:31:22 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.c,v 1.169 2004/02/10 16:08:54 iliaa Exp $ */
+/* $Id: fopen_wrappers.c,v 1.170 2004/03/16 00:31:22 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -131,11 +131,13 @@
        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) 
{

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to