summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/fopen_wrappers.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 5424f78970..53981059d1 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -233,6 +233,9 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
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 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
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 */