diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2005-01-24 16:47:18 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2005-01-24 16:47:18 +0000 |
commit | 76d91f2a3d6d9ce2813b501622a80ac79857f015 (patch) | |
tree | e85f361a33f0da45c56a5f8a366c3880c47926c0 | |
parent | 5a559e9a5776372cd6e4a1af17bc0c34ea5e4f7e (diff) | |
download | php-git-76d91f2a3d6d9ce2813b501622a80ac79857f015.tar.gz |
- Revert irrelevant part.
-rw-r--r-- | main/rfc1867.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c index b5b05df6e4..4982cf3e59 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -6,7 +6,6 @@ +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | @@ -33,7 +32,6 @@ #include "php_globals.h" #include "php_variables.h" #include "rfc1867.h" -#include "ext/standard/php_string.h" #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -849,7 +847,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) while (!multipart_buffer_eof(mbuff TSRMLS_CC)) { char buff[FILLUNIT]; - char *cd=NULL,*param=NULL,*filename=NULL; + char *cd=NULL,*param=NULL,*filename=NULL, *tmp=NULL; int blen=0, wlen=0; zend_llist_clean(&header); @@ -1079,16 +1077,30 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) str_len = strlen(filename); php_mb_gpc_encoding_converter(&filename, &str_len, 1, NULL, NULL TSRMLS_CC); } + s = php_mb_strrchr(filename, '\\' TSRMLS_CC); + if ((tmp = php_mb_strrchr(filename, '/' TSRMLS_CC)) > s) { + s = tmp; + } num_vars--; + } else { + s = strrchr(filename, '\\'); + if ((tmp = strrchr(filename, '/')) > s) { + s = tmp; + } + } +#else + s = strrchr(filename, '\\'); + if ((tmp = strrchr(filename, '/')) > s) { + s = tmp; } #endif - /* ensure that the uploaded file name only contains the path */ - php_basename(filename, strlen(filename), NULL, 0, &s, NULL TSRMLS_CC); - efree(filename); - filename = s; - + if (!is_anonymous) { - safe_php_register_variable(lbuf, filename, NULL, 0 TSRMLS_CC); + if (s && s > filename) { + safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC); + } else { + safe_php_register_variable(lbuf, filename, NULL, 0 TSRMLS_CC); + } } /* Add $foo[name] */ @@ -1097,7 +1109,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) } else { sprintf(lbuf, "%s[name]", param); } - register_http_post_files_variable(lbuf, filename, http_post_files, 0 TSRMLS_CC); + if (s && s > filename) { + register_http_post_files_variable(lbuf, s+1, http_post_files, 0 TSRMLS_CC); + } else { + register_http_post_files_variable(lbuf, filename, http_post_files, 0 TSRMLS_CC); + } efree(filename); s = NULL; |