cvs: php-src(PHP_5_0) /main rfc1867.c
| From: | Ilia Alshanetsky | Date: | Mon, 24 Jan 2005 22:41:41 +0000 |
| Subject: | cvs: php-src(PHP_5_0) /main rfc1867.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-30116@lists.php.net to get a copy of this message | ||
iliaa Mon Jan 24 17:41:41 2005 EDT
Modified files: (Branch: PHP_5_0)
/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.159.2.8&r2=1.159.2.9&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.159.2.8 php-src/main/rfc1867.c:1.159.2.9
--- php-src/main/rfc1867.c:1.159.2.8 Mon Jan 24 11:47:39 2005
+++ php-src/main/rfc1867.c Mon Jan 24 17:41:41 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.159.2.8 2005/01/24 16:47:39 moriyoshi Exp $ */
+/* $Id: rfc1867.c,v 1.159.2.9 2005/01/24 22:41:41 iliaa Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -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 @@
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) {