From: Ilia Alshanetsky Date: Tue, 27 Sep 2005 15:08:43 +0000 (+0000) Subject: MFH: Fixed bug #32937 (open_basedir looses trailing / in the limiter). X-Git-Tag: php-4.4.1RC1~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe06c9dcfd44430e409705901c5c1e4c8e1da1e9;p=php MFH: Fixed bug #32937 (open_basedir looses trailing / in the limiter). --- 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'; } }