+++ /dev/null
-From e7c25d5b603a33e677efc4bccb6e5cac617e7ad5 Mon Sep 17 00:00:00 2001
-From: Jeremy Harris <jgh146exb@wizmail.org>
-Date: Thu, 1 Jan 2015 21:47:10 +0000
-Subject: [PATCH] Avoid crash with badly-terminated non-recognised mime
- parameter
-
----
- src/mime.c | 18 +++++++++++-------
- test/log/4000 | 3 +++
- test/mail/4000.userx | 42 +++++++++++++++++++++++++++++++++++++++++
- test/scripts/4000-scanning/4000 | 32 +++++++++++++++++++++++++++++++
- test/stdout/4000 | 11 +++++++++++
- 5 files changed, 99 insertions(+), 7 deletions(-)
-
-diff --git a/src/mime.c b/src/mime.c
-index e5fe476..948dd78 100644
---- a/src/mime.c
-+++ b/src/mime.c
-@@ -589,6 +589,7 @@ DECODE_HEADERS:
- NEXT_PARAM_SEARCH:
- while (*p)
- {
-+ /* debug_printf(" considering paramlist '%s'\n", p); */
- mime_parameter * mp;
- for (mp = mime_parameter_list;
- mp < &mime_parameter_list[mime_parameter_list_size];
-@@ -623,7 +624,7 @@ NEXT_PARAM_SEARCH:
-
- param_value = rfc2047_decode(param_value,
- check_rfc2047_length, NULL, 32, NULL, &dummy);
-- debug_printf("Found %s MIME parameter in %s header, "
-+ debug_printf(" Found %s MIME parameter in %s header, "
- "value is '%s'\n", mp->name, mime_header_list[i].name,
- param_value);
- }
-@@ -631,14 +632,17 @@ NEXT_PARAM_SEARCH:
- goto NEXT_PARAM_SEARCH;
- }
- }
-- /* There is something, but not one of our interesting parameters.
-- Advance to the next semicolon */
-- while(*p != ';')
-+ /* There is something, but not one of our interesting parameters.
-+ Advance to the next unquoted semicolon */
-+ while(*p && *p != ';')
-+ if (*p == '"')
- {
-- if (*p == '"') while(*++p && *p != '"') ;
-- p++;
-+ while(*++p && *p != '"') ;
-+ if (*p) p++;
- }
-- p++;
-+ else
-+ p++;
-+ if (*p) p++;
- }
- }
- }