summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2001-01-03 10:52:26 +0000
committerStanislav Malyshev <stas@php.net>2001-01-03 10:52:26 +0000
commitea46f79a97f2e92306573fcb3a17df90756cb5c9 (patch)
treead68d9bbd4aad0f51857566df6fdbefbe2f2ff99 /main
parent6b23ef6cef90735babcb8c2ab9095c5fe266b50c (diff)
downloadphp-git-ea46f79a97f2e92306573fcb3a17df90756cb5c9.tar.gz
Fix #8486 (name= without quotes in MIME Content-Disposition header)
Ported fix by kk/sas from PHP 3
Diffstat (limited to 'main')
-rw-r--r--main/rfc1867.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 40567f3507..195b567f80 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -167,11 +167,20 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S
SAFE_RETURN;
}
loc = memchr(ptr, '\n', rem);
- name = strstr(ptr, " name=\"");
+ name = strstr(ptr, " name=");
if (name && name < loc) {
- name += 7;
+ name += 6;
s = memchr(name, '\"', loc - name);
- if (!s) {
+ if ( name == s ) {
+ name++;
+ s = memchr(name, '\"', loc - name);
+ if(!s) {
+ php_error(E_WARNING, "File Upload Mime headers garbled name: [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
+ SAFE_RETURN;
+ }
+ } else if(!s) {
+ s = loc;
+ } else {
php_error(E_WARNING, "File Upload Mime headers garbled name: [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
SAFE_RETURN;
}