aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-13 09:42:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-13 09:42:12 +0800
commitfc4267680a9f4f8bf31d058ae126e7377dfb8d10 (patch)
tree13f90141e632e39e9a30fec6254030553e7af46b
parentcad6e285aa250a9adbd7064fa64ac766646adc0c (diff)
downloadgsoc2013-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
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-parser.c32
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 {