From: David Levine Date: Thu, 7 Feb 2013 02:28:29 +0000 (-0600) Subject: output_content() assumed that ci->ci_values[0] was the boundary, X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/102b7de56d30dfa217b4f4bc58328b5bc96e7675?ds=sidebyside;hp=49c748c77f3c9b9ea024c4eb5d1d83855d7e7201 output_content() assumed that ci->ci_values[0] was the boundary, but that's not always the case. Added search for the boundary in ci->ci_attrs[]. --- diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index 59bf7a42..d3a0a85b 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -83,6 +83,14 @@ output_content (CT ct, FILE *out) { int result = 0; CI ci = &ct->c_ctinfo; + char *boundary = ci->ci_values[0], **ap, **vp; + + for (ap = ci->ci_attrs, vp = ci->ci_values; *ap; ++ap, ++vp) { + if (! mh_strcasecmp ("boundary", *ap)) { + boundary = *vp; + break; + } + } /* * Output all header fields for this content @@ -113,11 +121,11 @@ output_content (CT ct, FILE *out) for (part = m->mp_parts; part; part = part->mp_next) { CT p = part->mp_part; - fprintf (out, "\n--%s\n", ci->ci_values[0]); + fprintf (out, "\n--%s\n", boundary); if (output_content (p, out) == NOTOK) return NOTOK; } - fprintf (out, "\n--%s--\n", ci->ci_values[0]); + fprintf (out, "\n--%s--\n", boundary); } break;