From a7ce772222dc2e6b7bbdf3113d76852b2eeef603 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 22 Nov 2006 11:55:36 +0000 Subject: [PATCH] fix #39575 (move_uploaded_file() no longer working (safe mode related)) --- main/fopen_wrappers.c | 2 +- main/safe_mode.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index b4f3fcb7d69..9f9d9f7305c 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -531,7 +531,7 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC) new_state.cwd = strdup(cwd); new_state.cwd_length = strlen(cwd); - if(virtual_file_ex(&new_state, filepath, NULL, 1)) { + if(virtual_file_ex(&new_state, filepath, NULL, CWD_FILEPATH)) { free(new_state.cwd); return NULL; } diff --git a/main/safe_mode.c b/main/safe_mode.c index e66b43f12dd..e0407a291dc 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -55,6 +55,8 @@ PHPAPI int php_checkuid_ex(const char *filename, const char *fopen_mode, int mod php_stream_wrapper *wrapper = NULL; TSRMLS_FETCH(); + path[0] = '\0'; + if (!filename) { return 0; /* path must be provided */ } @@ -84,7 +86,7 @@ PHPAPI int php_checkuid_ex(const char *filename, const char *fopen_mode, int mod * If that fails, passthrough and check directory... */ if (mode != CHECKUID_ALLOW_ONLY_DIR) { - VCWD_REALPATH(filename, path); + expand_filepath(filename, path TSRMLS_CC); ret = VCWD_STAT(path, &sb); if (ret < 0) { if (mode == CHECKUID_DISALLOW_FILE_NOT_EXISTS) {