summaryrefslogtreecommitdiffstats
path: root/handler.c
diff options
context:
space:
mode:
authorEdmund GRIMLEY EVANS <edmundo@rano.org>2003-03-04 09:31:19 +0000
committerEdmund GRIMLEY EVANS <edmundo@rano.org>2003-03-04 09:31:19 +0000
commit2dc180493ee59791d47326a45e47d767952146ae (patch)
tree1cc7246aedf6908c75ac5d9cc66e37b82c57833e /handler.c
parent05f6cf0dc1efdbd2f39a183e0877e909f30f8501 (diff)
Be more friendly about bad multipart/alternative bodies; #1478. Note
that the relevant standards explicitly *forbid* nested MIME encodings.
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/handler.c b/handler.c
index 98d9190b..fead17c2 100644
--- a/handler.c
+++ b/handler.c
@@ -1198,6 +1198,24 @@ static void alternative_handler (BODY *a, STATE *s)
LIST *t;
char buf[STRING];
int type = 0;
+ int mustfree = 0;
+
+ if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
+ a->encoding == ENCUUENCODED)
+ {
+ struct stat st;
+ mustfree = 1;
+ fstat (fileno (s->fpin), &st);
+ b = mutt_new_body ();
+ b->length = (long) st.st_size;
+ b->parts = mutt_parse_multipart (s->fpin,
+ mutt_get_parameter ("boundary", a->parameter),
+ (long) st.st_size, ascii_strcasecmp ("digest", a->subtype) == 0);
+ }
+ else
+ b = a;
+
+ a = b;
/* First, search list of prefered types */
t = AlternativeOrderList;
@@ -1324,6 +1342,9 @@ static void alternative_handler (BODY *a, STATE *s)
state_mark_attach (s);
state_puts(_("[-- Error: Could not display any parts of Multipart/Alternative! --]\n"), s);
}
+
+ if (mustfree)
+ mutt_free_body(&a);
}
/* handles message/rfc822 body parts */