From 40a26905052f7f00c44ad81c92f2bb38c48e5a4f Mon Sep 17 00:00:00 2001 From: Paul Fox Date: Wed, 4 Mar 2015 13:10:38 -0500 Subject: [PATCH] mhparse.c: verify all MIME-Version: headers encountered in addition to verifying, silently ignore duplicate version headers. --- uip/mhparse.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/uip/mhparse.c b/uip/mhparse.c index dd4c5e9..7c8f07d 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -41,6 +41,7 @@ int suppress_bogus_mp_content_warning; int bogus_mp_content; int suppress_extraneous_trailing_semicolon_warning; int extraneous_trailing_semicolon; +int suppress_multiple_mime_version_warning = 1; /* list of preferred type/subtype pairs, for -prefer */ char *preferred_types[NPREFS], @@ -365,16 +366,12 @@ get_content (FILE *in, char *file, int toplevel) if (!strcasecmp (hp->name, VRSN_FIELD)) { int ucmp; char c, *cp, *dp; + char *vrsn; - if (ct->c_vrsn) { - advise (NULL, "message %s has multiple %s: fields", - ct->c_file, VRSN_FIELD); - goto next_header; - } - ct->c_vrsn = add (hp->value, NULL); + vrsn = add (hp->value, NULL); /* Now, cleanup this field */ - cp = ct->c_vrsn; + cp = vrsn; while (isspace ((unsigned char) *cp)) cp++; @@ -401,6 +398,14 @@ get_content (FILE *in, char *file, int toplevel) admonish (NULL, "message %s has unknown value for %s: field (%s)", ct->c_file, VRSN_FIELD, cp); } + if (!ct->c_vrsn) { + ct->c_vrsn = vrsn; + } else { + if (! suppress_multiple_mime_version_warning) + advise (NULL, "message %s has multiple %s: fields", + ct->c_file, VRSN_FIELD); + free(vrsn); + } } else if (!strcasecmp (hp->name, TYPE_FIELD)) { /* Get Content-Type field */ -- 1.9.1