iliaa Mon Jan 24 18:52:29 2005 EDT Modified files: (Branch: PHP_4_3) /php-src/main rfc1867.c Log: MFH: Use multibyte specific code for handling files and generic basename based code in all other instances. http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.122.2.30&r2=1.122.2.31&ty=u Index: php-src/main/rfc1867.c diff -u php-src/main/rfc1867.c:1.122.2.30 php-src/main/rfc1867.c:1.122.2.31 --- php-src/main/rfc1867.c:1.122.2.30 Mon Jan 24 11:47:53 2005 +++ php-src/main/rfc1867.c Mon Jan 24 18:52:27 2005 @@ -16,7 +16,7 @@ | Jani Taskinen <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.122.2.30 2005/01/24 16:47:53 moriyoshi Exp $ */ +/* $Id: rfc1867.c,v 1.122.2.31 2005/01/24 23:52:27 iliaa Exp $ */ /* * This product includes software developed by the Apache Group @@ -31,6 +31,7 @@ #include "php_globals.h" #include "php_variables.h" #include "rfc1867.h" +#include "ext/standard/php_string.h" #undef DEBUG_FILE_UPLOAD @@ -1069,18 +1070,17 @@ 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 */ + s = php_basename(filename, strlen(filename), NULL, 0); + efree(filename); + filename = s; +#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING) +filedone: +#endif if (s && s > filename) { safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC); } else {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php