Bug 732369 - Content-Disposition parser does not require presence of ";" between params. r=jduell

This commit is contained in:
Julian Reschke 2012-06-07 22:57:00 -07:00
Родитель 4d4141d6be
Коммит ff9787a741
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -619,7 +619,13 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const char *aHeaderValue,
// skip over whitespace, ';', whitespace.
increment_str:
while (nsCRT::IsAsciiSpace(*str)) ++str;
if (*str == ';') ++str;
if (*str == ';') {
++str;
} else {
// stop processing the header field; either we are done or the
// separator was missing
break;
}
while (nsCRT::IsAsciiSpace(*str)) ++str;
}

Просмотреть файл

@ -112,7 +112,7 @@ var tests = [
// First series, only please, and don't slurp up higher elements (*2 in this
// case) from later series into earlier one (invalid; error recovery)
["attachment; filename=basic; filename*0*=UTF-8''multi\r\n"
["attachment; filename=basic; filename*0*=UTF-8''multi;\r\n"
+ " filename*1=line;\r\n"
+ " filename*0*=UTF-8''wrong;\r\n"
+ " filename*1=bad;\r\n"
@ -397,9 +397,16 @@ var tests = [
"attachment", "basic"],
// Bug 732369: Content-Disposition parser does not require presence of ";" between params
// optimally, this would not even return the disposition type "attachment"
["attachment; extension=bla filename=foo",
"attachment", Cr.NS_ERROR_INVALID_ARG],
["attachment; filename=foo extension=bla",
"attachment", "foo"],
["attachment filename=foo",
"attachment", Cr.NS_ERROR_INVALID_ARG],
];
var rfc5987paramtests = [