From a1c036b8cf08aef7cb65b3a30cd406489e3e1b11 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sat, 10 Jun 2000 15:15:28 +0000 Subject: [PATCH] - Fix bug in virtual_file_ex when the resulting path is the root. --- main/php_virtual_cwd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/php_virtual_cwd.c b/main/php_virtual_cwd.c index 03ba8f4b21..ca598536d6 100644 --- a/main/php_virtual_cwd.c +++ b/main/php_virtual_cwd.c @@ -327,6 +327,13 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func ptr = php_strtok_r(NULL, TOKENIZER_STRING, &tok); } + if (state->cwd_length == COPY_WHEN_ABSOLUTE) { + state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1); + state->cwd[state->cwd_length] = DEFAULT_SLASH; + state->cwd[state->cwd_length+1] = '\0'; + state->cwd_length++; + } + if (verify_path && verify_path(state)) { CWD_STATE_FREE(state); -- 2.50.1