diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2003-07-30 17:55:06 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2003-07-30 17:55:06 +0000 |
| commit | 9ba651c692dd163204a0bdeb6db88cb826f93e12 (patch) | |
| tree | 3499b6207328f25f16b2054c4a717f558a822a65 | |
| parent | 68fa4e50f8a3ba3fda5d661edeb453e5cf08ddc6 (diff) | |
| download | php-git-9ba651c692dd163204a0bdeb6db88cb826f93e12.tar.gz | |
Fixed bug #24873 (incorrect handling of / inside open_basedir)
| -rw-r--r-- | main/fopen_wrappers.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index e12f0a992a..e709327672 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -129,19 +129,19 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path /* 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 */ |
