diff options
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/camel-mime-parser.c | 32 |
2 files changed, 23 insertions, 15 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 4abe34186d..56fd149a07 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2000-09-12 Jeffrey Stedfast <fejj@helixcode.com> + + * camel-mime-parser.c (folder_scan_step): Make sure *datalength is + > 0 before calling camel_mime_filter_filter otherwise we will get + a segfault if the filter calls iconv(). + 2000-09-08 Christopher James Lahey <clahey@helixcode.com> * providers/nntp/camel-nntp-auth.c, diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index 9599e5bde2..0926748504 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -1563,42 +1563,44 @@ tail_recurse: folder_push_part(s, h); s->state = type; return; - + case HSCAN_HEADER: s->state = HSCAN_BODY; - + case HSCAN_BODY: h = s->parts; *datalength = 0; presize = SCAN_HEAD; f = s->filters; - + do { - hb = folder_scan_content(s, &state, databuffer, datalength); - if (*datalength>0) { - d(printf("Content raw: '%.*s'\n", *datalength, *databuffer)); - + hb = folder_scan_content (s, &state, databuffer, datalength); + if (*datalength > 0) { + d(printf ("Content raw: '%.*s'\n", *datalength, *databuffer)); + while (f) { - camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize, - databuffer, datalength, &presize); + camel_mime_filter_filter (f->filter, *databuffer, *datalength, presize, + databuffer, datalength, &presize); f = f->next; } return; } - } while (hb==h && *datalength>0); - + } while (hb == h && *datalength > 0); + /* check for any filter completion data */ while (f) { - camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize, - databuffer, datalength, &presize); + if (*datalength > 0) { + camel_mime_filter_filter (f->filter, *databuffer, *datalength, presize, + databuffer, datalength, &presize); + } f = f->next; } if (*datalength > 0) return; - + s->state = HSCAN_BODY_END; break; - + case HSCAN_MULTIPART: h = s->parts; do { |