Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lubar <ben.lubar@gmail.com>2018-02-06 23:32:00 +0300
committerMarek Safar <marek.safar@gmail.com>2018-02-23 17:28:55 +0300
commit38846ee7548ff9c3c0b8056e657e020c9d97f838 (patch)
treedc5dcfaadf2667b1a5691f80531602d37c431ded /mcs/class/System.Web
parent9c55770f3fd2df58df79cdedf42b401f96931188 (diff)
Properly handle non-quoted multipart content dispositions
Fixes #6801
Diffstat (limited to 'mcs/class/System.Web')
-rwxr-xr-xmcs/class/System.Web/System.Web/HttpRequest.cs28
1 files changed, 22 insertions, 6 deletions
diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs
index 4a07cee7e33..98c1238a41b 100755
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -2068,11 +2068,19 @@ namespace System.Web
static string GetContentDispositionAttribute (string l, string name)
{
- int idx = l.IndexOf (name + "=\"");
+ int idx = l.IndexOf (name + "=");
if (idx < 0)
return null;
- int begin = idx + name.Length + "=\"".Length;
- int end = l.IndexOf ('"', begin);
+ int begin = idx + name.Length + "=".Length;
+ int end;
+ if (l.Length > begin && l [begin] == '"') {
+ begin++;
+ end = l.IndexOf ('"', begin);
+ } else {
+ end = l.IndexOf (';', begin);
+ if (end == -1)
+ end = l.Length;
+ }
if (end < 0)
return null;
if (begin == end)
@@ -2082,11 +2090,19 @@ namespace System.Web
string GetContentDispositionAttributeWithEncoding (string l, string name)
{
- int idx = l.IndexOf (name + "=\"");
+ int idx = l.IndexOf (name + "=");
if (idx < 0)
return null;
- int begin = idx + name.Length + "=\"".Length;
- int end = l.IndexOf ('"', begin);
+ int begin = idx + name.Length + "=".Length;
+ int end;
+ if (l.Length > begin && l [begin] == '"') {
+ begin++;
+ end = l.IndexOf ('"', begin);
+ } else {
+ end = l.IndexOf (';', begin);
+ if (end == -1)
+ end = l.Length;
+ }
if (end < 0)
return null;
if (begin == end)