]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/mime_parser.c
Mimeparser rewrite; fix bug detecting trailing MIME-Boundary
[citadel.git] / libcitadel / lib / mime_parser.c
index 24b76477975128251fcfffb8386da929487c14ff..f2aec777ab1b41774aed4cc5ed946fed9197ab79 100644 (file)
@@ -210,6 +210,8 @@ void mime_decode(char *partnum,
                strcpy(encoding, "");
        if (!strcasecmp(encoding, "binary"))
                strcpy(encoding, "");
+       if (!strcasecmp(encoding, "ISO-8859-1"))
+               strcpy(encoding, "");
 
        /* If this part is not encoded, send as-is */
        if ( (strlen(encoding) == 0) || (dont_decode)) {
@@ -543,7 +545,7 @@ static char *FindNextContent(char *ptr,
                
 
                srch = next_boundary = NULL;
-               for (srch = memchr(ptr, '-',  content_end - srch);
+               for (srch = memchr(ptr, '-',  content_end - ptr);
                     (srch != NULL) && (srch < content_end); 
                     srch = memchr(srch, '-',  content_end - srch)) 
                {
@@ -678,8 +680,8 @@ static void recurseable_mime_parser(char *partnum,
                        if (next_boundary != NULL) {
                                /* If we pass out of scope, don't attempt to
                                 * read past the end boundary. */
-                               if ((*(next_boundary + m->b[startary].len + 1) == '-') && 
-                                   (*(next_boundary + m->b[startary].len + 2) == '-') ){
+                               if ((*(next_boundary + m->b[startary].len) == '-') && 
+                                   (*(next_boundary + m->b[startary].len + 1) == '-') ){
                                        ptr = content_end;
                                }
                                else {