Commit 5e735f17 authored by Richard Curnow's avatar Richard Curnow

Cope with spaces in multipart boundary strings

Original rev  : rc@rc0.org.uk--2004-mairix/mairix--dev--0.15--patch-7

Chung-chieh Shan wrote:
>
> Hello,
>
> Mairix's multipart parsing code in rfc822.c does not take into account
> the possibility that a Content-Type header might look like
>
>     Content-Type: multipart/mixed; boundary="with spaces"
>
> The following patch fixes this problem, though it probably still doesn't
> understand everything it should about multipart messages.
>
> +++ mairix-0.14/rfc822.c
> @@ -434,7 +434,7 @@
>        value = eq + 1;
>        if (!*value) break;
>
> -      for (semi = value+1; *semi && !isspace(*semi) && (*semi != ';'); semi++) ;
> +      for (semi = value+1; *semi && (*value == '"' || !isspace(*semi)) && (*semi != ';'); semi++) ;
>
>        if (!strncasecmp(name, "boundary", 8)) {
>          result->boundary = copy_string_start_end_unquote(value, semi);
parent 0d002db4
......@@ -4,6 +4,7 @@ Andre Costa
Aredridel
Bardur Arantsson
Christopher Rosado
Chung-chieh Shan
Corrin Lakeland
Dan Egnor
Emil Sit
......
......@@ -432,7 +432,7 @@ static void parse_content_type(char *hdrline, struct content_type_header *result
value = eq + 1;
if (!*value) break;
for (semi = value+1; *semi && !isspace(*semi) && (*semi != ';'); semi++) ;
for (semi = value+1; *semi && (*value = '"' || !isspace(*semi)) && (*semi != ';'); semi++) ;
if (!strncasecmp(name, "boundary", 8)) {
result->boundary = copy_string_start_end_unquote(value, semi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment