From: Ilia Alshanetsky Date: Mon, 24 Jan 2005 22:41:41 +0000 (+0000) Subject: MFH: Use multibyte specific code for handling files and generic basename X-Git-Tag: php-5.0.4RC1~257 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5b1ec723de2c7ce47481b05a53e42257a13b8d1;p=php MFH: Use multibyte specific code for handling files and generic basename based code in all other instances. --- diff --git a/main/rfc1867.c b/main/rfc1867.c index 4982cf3e59..ba3c5d05cc 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -32,6 +32,7 @@ #include "php_globals.h" #include "php_variables.h" #include "rfc1867.h" +#include "ext/standard/php_string.h" #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -1082,18 +1083,19 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) 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; + goto filedone; } #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 HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING) +filedone: +#endif + if (!is_anonymous) { if (s && s > filename) {