iliaa           Wed Jul 30 13:55:06 2003 EDT

  Modified files:              
    /php-src/main       fopen_wrappers.c 
  Log:
  Fixed bug #24873 (incorrect handling of / inside open_basedir)
  
  
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.165 php-src/main/fopen_wrappers.c:1.166
--- php-src/main/fopen_wrappers.c:1.165 Mon Jul 21 21:32:01 2003
+++ php-src/main/fopen_wrappers.c       Wed Jul 30 13:55:06 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.c,v 1.165 2003/07/22 01:32:01 iliaa Exp $ */
+/* $Id: fopen_wrappers.c,v 1.166 2003/07/30 17:55:06 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -129,19 +129,19 @@
 
        /* Resolve the real path into resolved_name */
        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 / */            
-               if (basedir[strlen(basedir)-1] == PHP_DIR_SEPARATOR) {
-                       resolved_basedir_len = strlen(resolved_basedir);
+               /* Handler for basedirs that end with a / */
+               resolved_basedir_len = strlen(resolved_basedir);
+               if (basedir[strlen(basedir)-1] == PHP_DIR_SEPARATOR && 
resolved_basedir[resolved_basedir_len -1] != PHP_DIR_SEPARATOR) {
                        resolved_basedir[resolved_basedir_len] = '/';
                        resolved_basedir[++resolved_basedir_len] = '\0';
-               } else {
-                       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';
+                       if (resolved_name[resolved_name_len - 1] != PHP_DIR_SEPARATOR) 
{
+                               resolved_name[resolved_name_len] = '/';
+                               resolved_name[++resolved_name_len] = '\0';
+                       }
                }
 
                /* Check the path */



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

Reply via email to