diff options
author | Not Zed <NotZed@Ximian.com> | 2002-04-12 06:43:56 +0000 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-04-12 06:43:56 +0000 |
commit | 9a3185f4d4fa49b01d398f105d819f2d3ffad750 (patch) | |
tree | 9a4f2551330e152477029a58d03fcdb6d9490487 | |
parent | 54fcf246ab510e67674abb779d8ee3642b6d3682 (diff) | |
download | evolution-data-server-9a3185f4d4fa49b01d398f105d819f2d3ffad750.tar.gz |
If we get multiple Content-Type header values, change subsequent headers
2002-04-09 Not Zed <NotZed@Ximian.com>
* camel-mime-part.c (construct_from_parser): If we get multiple
Content-Type header values, change subsequent headers to
X-Invalid-Content-Type so it doesn't wreck processing. This fixes
the reported case in #18929, but i dont know if it fixes the
original posters problems.
2002-04-08 Not Zed <NotZed@Ximian.com>
* camel-mime-utils.c (base64_decode_step): If we only get passed
'=', we back track only if we actually output any data. Fix for
#21716.
(quoted_decode): Pass out size_t instead of int, and use 0 instead
of -1 for error since its not signed. This will fix similar bug
to above in different circumstances since the result is taken as
unsigned. This is only an internal func.
(quoted_encode): Return size_t just for consistency.
-rw-r--r-- | camel/ChangeLog | 19 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 9 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 8 |
3 files changed, 30 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index bc861ccd1..0ede08f55 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,22 @@ +2002-04-09 Not Zed <NotZed@Ximian.com> + + * camel-mime-part.c (construct_from_parser): If we get multiple + Content-Type header values, change subsequent headers to + X-Invalid-Content-Type so it doesn't wreck processing. This fixes + the reported case in #18929, but i dont know if it fixes the + original posters problems. + +2002-04-08 Not Zed <NotZed@Ximian.com> + + * camel-mime-utils.c (base64_decode_step): If we only get passed + '=', we back track only if we actually output any data. Fix for + #21716. + (quoted_decode): Pass out size_t instead of int, and use 0 instead + of -1 for error since its not signed. This will fix similar bug + to above in different circumstances since the result is taken as + unsigned. This is only an internal func. + (quoted_encode): Return size_t just for consistency. + 2002-02-22 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-part.c (camel_mime_part_set_filename): Set the 'name' diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 320efcf52..7cc3c71f4 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -242,7 +242,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ g_free (mime_part->content_location); mime_part->content_location = header_location_decode (header_value); break; - case HEADER_CONTENT_TYPE: + case HEADER_CONTENT_TYPE: if (mime_part->content_type) header_content_type_unref (mime_part->content_type); mime_part->content_type = header_content_type_decode (header_value); @@ -692,9 +692,14 @@ construct_from_parser(CamelMimePart *dw, CamelMimeParser *mp) process_header((CamelMedium *)dw, "content-type", content); while (headers) { - camel_medium_add_header((CamelMedium *)dw, headers->name, headers->value); + if (strcasecmp(headers->name, "content-type") == 0 + && headers->value != content) + camel_medium_add_header((CamelMedium *)dw, "X-Invalid-Content-Type", headers->value); + else + camel_medium_add_header((CamelMedium *)dw, headers->name, headers->value); headers = headers->next; } + camel_mime_part_construct_content_from_parser(dw, mp); break; default: diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 47e26bf78..8563a4f14 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -374,7 +374,7 @@ base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state while (inptr>in && i) { inptr--; if (camel_mime_base64_rank[*inptr] != 0xff) { - if (*inptr == '=') + if (*inptr == '=' && outptr>out) outptr--; i--; } @@ -858,7 +858,7 @@ quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *saves this is for the "Q" encoding of international words, which is slightly different than plain quoted-printable (mainly by allowing 0x20 <> _) */ -static int +static size_t quoted_decode(const unsigned char *in, size_t len, unsigned char *out) { register const unsigned char *inptr; @@ -899,13 +899,13 @@ quoted_decode(const unsigned char *in, size_t len, unsigned char *out) if (ret==0) { return outptr-out; } - return -1; + return 0; } /* rfc2047 version of quoted-printable */ /* safemask is the mask to apply to the camel_mime_special_table to determine what characters can safely be included without encoding */ -static int +static size_t quoted_encode (const unsigned char *in, size_t len, unsigned char *out, unsigned short safemask) { register const unsigned char *inptr, *inend; |