diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-13 09:42:12 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-13 09:42:12 +0800 |
commit | fc4267680a9f4f8bf31d058ae126e7377dfb8d10 (patch) | |
tree | 13f90141e632e39e9a30fec6254030553e7af46b /camel/camel-mime-parser.c | |
parent | cad6e285aa250a9adbd7064fa64ac766646adc0c (diff) | |
download | gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar.gz gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar.bz2 gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar.lz gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar.xz gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.tar.zst gsoc2013-evolution-fc4267680a9f4f8bf31d058ae126e7377dfb8d10.zip |
Make sure *datalength is > 0 before calling camel_mime_filter_filter
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().
svn path=/trunk/; revision=5395
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r-- | camel/camel-mime-parser.c | 32 |
1 files changed, 17 insertions, 15 deletions
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 { |