iliaa Wed Jul 30 13:55:21 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/main fopen_wrappers.c
Log:
MFH: 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.153.2.6 php-src/main/fopen_wrappers.c:1.153.2.7
--- php-src/main/fopen_wrappers.c:1.153.2.6 Mon Jul 21 21:32:21 2003
+++ php-src/main/fopen_wrappers.c Wed Jul 30 13:55:21 2003
@@ -16,7 +16,7 @@
| Jim Winstead <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.153.2.6 2003/07/22 01:32:21 iliaa Exp $ */
+/* $Id: fopen_wrappers.c,v 1.153.2.7 2003/07/30 17:55:21 iliaa Exp $ */
/* {{{ includes
*/
@@ -130,19 +130,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