pajoye                                   Tue, 23 Nov 2010 22:14:54 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305698

Log:
- fixed #53352

Bug: http://bugs.php.net/53352 (Assigned) open_basedir does not pass through 
files with matching path
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
    U   php/php-src/trunk/main/fopen_wrappers.c

Modified: php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2010-11-23 21:49:18 UTC 
(rev 305697)
+++ php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2010-11-23 22:14:54 UTC 
(rev 305698)
@@ -234,6 +234,9 @@
                                resolved_basedir[resolved_basedir_len] = 
PHP_DIR_SEPARATOR;
                                resolved_basedir[++resolved_basedir_len] = '\0';
                        }
+               } else {
+                               resolved_basedir[resolved_basedir_len++] = 
PHP_DIR_SEPARATOR;
+                               resolved_basedir[resolved_basedir_len] = '\0';
                }

                resolved_name_len = strlen(resolved_name);
@@ -251,7 +254,7 @@
                if (strncmp(resolved_basedir, resolved_name, 
resolved_basedir_len) == 0) {
 #endif
                        if (resolved_name_len > resolved_basedir_len &&
-                               resolved_name[resolved_basedir_len] != 
PHP_DIR_SEPARATOR) {
+                               resolved_name[resolved_basedir_len - 1] != 
PHP_DIR_SEPARATOR) {
                                return -1;
                        } else {
                                /* File is in the right directory */

Modified: php/php-src/trunk/main/fopen_wrappers.c
===================================================================
--- php/php-src/trunk/main/fopen_wrappers.c     2010-11-23 21:49:18 UTC (rev 
305697)
+++ php/php-src/trunk/main/fopen_wrappers.c     2010-11-23 22:14:54 UTC (rev 
305698)
@@ -233,6 +233,9 @@
                                resolved_basedir[resolved_basedir_len] = 
PHP_DIR_SEPARATOR;
                                resolved_basedir[++resolved_basedir_len] = '\0';
                        }
+               } else {
+                               resolved_basedir[resolved_basedir_len++] = 
PHP_DIR_SEPARATOR;
+                               resolved_basedir[resolved_basedir_len] = '\0';
                }

                resolved_name_len = strlen(resolved_name);
@@ -250,7 +253,7 @@
                if (strncmp(resolved_basedir, resolved_name, 
resolved_basedir_len) == 0) {
 #endif
                        if (resolved_name_len > resolved_basedir_len &&
-                               resolved_name[resolved_basedir_len] != 
PHP_DIR_SEPARATOR) {
+                               resolved_name[resolved_basedir_len - 1] != 
PHP_DIR_SEPARATOR) {
                                return -1;
                        } else {
                                /* File is in the right directory */

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

Reply via email to