X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ebc5d74891031b94075b1547a9bd842224df67d3..cdec1be974fb9a041d75d4e363463e58766309b3:/uip/mhbuildsbr.c diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 19d31316..68c555d3 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -173,6 +173,7 @@ build_mime (char *infile, int autobuild, int dist, int directives, strcasecmp (name, ENCODING_FIELD) == 0) { if (autobuild) { fclose(in); + free (ct); return NULL; } else { adios (NULL, "draft shouldn't contain %s: field", name); @@ -398,7 +399,6 @@ finish_field: if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL) adios (NULL, "out of memory"); *pp = part; - pp = &part->mp_next; part->mp_part = p; } @@ -780,7 +780,6 @@ use_forw: adios (NULL, "out of memory"); init_decoded_content(ct, infilename); *ctp = ct; - ci = &ct->c_ctinfo; if (get_ctinfo (buffer, ct, 0) == NOTOK) done (1); ct->c_type = CT_MESSAGE; @@ -1476,9 +1475,16 @@ scan_content (CT ct, size_t maxunencoded) t = (struct text *) ct->c_ctparams; if (t->tx_charset == CHARSET_UNSPECIFIED) { CI ci = &ct->c_ctinfo; + char *eightbitcharset = write_charset_8bit(); + + if (contains8bit && strcasecmp(eightbitcharset, "US-ASCII") == 0) { + adios(NULL, "Text content contains 8 bit characters, but " + "character set is US-ASCII"); + } add_param(&ci->ci_first_pm, &ci->ci_last_pm, "charset", - contains8bit ? write_charset_8bit() : "us-ascii", 0); + contains8bit ? eightbitcharset : "us-ascii", 0); + t->tx_charset = CHARSET_SPECIFIED; } }