From fe06c9dcfd44430e409705901c5c1e4c8e1da1e9 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 27 Sep 2005 15:08:43 +0000 Subject: [PATCH] MFH: Fixed bug #32937 (open_basedir looses trailing / in the limiter). --- NEWS | 1 + main/fopen_wrappers.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fbb4bcd689..2a1a7ef340 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ PHP 4 NEWS (Ilia) - Fixed bug #33940 (array_map() fails to pass by reference when called recursively). (Dmitry) +- Fixed bug #32937 (open_basedir looses trailing / in the limiter). (Adam C.) - Fixed bug #33690 (Crash setting some ini directives in httpd.conf). (Rasmus) - Fixed bug #33673 (Added detection for partially uploaded files). (Ilia) - Fixed bug #33648 (Using --with-regex=system causes compile failure). (Andrei) diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index e4790d4557..627c3e557f 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -110,8 +110,8 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path /* Handler for basedirs that end with a / */ resolved_basedir_len = strlen(resolved_basedir); if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) { - if (resolved_basedir[resolved_basedir_len - 1] == '/') { - resolved_basedir[resolved_basedir_len - 1] = PHP_DIR_SEPARATOR; + if (resolved_basedir[resolved_basedir_len - 1] != PHP_DIR_SEPARATOR) { + resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR; resolved_basedir[++resolved_basedir_len] = '\0'; } } -- 2.50.1