From: Wilfried Goesgens Date: Thu, 9 Dec 2010 00:05:16 +0000 (+0100) Subject: More tiny bugfixes on the mimeparser X-Git-Tag: v8.01~529^2 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=585ffccc2892fd5ca1a2aae3686b7d9199f35bd4 More tiny bugfixes on the mimeparser - in the for-loop, search first start as initializer, this saves one unneccesary memcmp - cr/lf detection: we need to do that _before_ the first mime content is evaluated. --- diff --git a/libcitadel/lib/mime_parser.c b/libcitadel/lib/mime_parser.c index 7e4cbfb22..56336ba6a 100644 --- a/libcitadel/lib/mime_parser.c +++ b/libcitadel/lib/mime_parser.c @@ -538,8 +538,8 @@ static char *FindNextContent(char *ptr, } - next_boundary = NULL; - for (srch=ptr; + srch = next_boundary = NULL; + for (srch = memchr(ptr, '-', content_end - srch); (srch != NULL) && (srch < content_end); srch = memchr(srch, '-', content_end - srch)) { @@ -620,9 +620,15 @@ static void recurseable_mime_parser(char *partnum, ptr ++; part_start = NULL; do { + char *optr; + optr = ptr; if (parse_MimeHeaders(SubMimeHeaders, &ptr, content_end) != 0) break; + if ((ptr - optr > 2) && + (*(ptr - 2) == '\r')) + crlf_in_use = 1; + part_start = ptr; next_boundary = FindNextContent(ptr,