From: Thomas Roessler Date: Thu, 15 Jun 2000 10:05:32 +0000 (+0000) Subject: Avoid dumping core when Charset isn't set. X-Git-Tag: mutt-1-3-4-rel~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f66b64a463431899c4f4b1fa3f26d50909c450f;p=mutt Avoid dumping core when Charset isn't set. --- diff --git a/copy.c b/copy.c index 5ae716c1..596f1b6f 100644 --- a/copy.c +++ b/copy.c @@ -294,7 +294,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix) fputs ("Mime-Version: 1.0\n", out); fputs ("Content-Transfer-Encoding: 8bit\n", out); fputs ("Content-Type: text/plain; charset=", out); - rfc822_cat(buffer, sizeof(buffer), Charset, MimeSpecials); + rfc822_cat(buffer, sizeof(buffer), Charset ? Charset : "", MimeSpecials); fputs(buffer, out); fputc('\n', out); diff --git a/handler.c b/handler.c index 671c5200..c59e9458 100644 --- a/handler.c +++ b/handler.c @@ -1340,7 +1340,7 @@ void mutt_decode_attachment (BODY *b, STATE *s) if (istext && s->flags & M_CHARCONV) { char *charset = mutt_get_parameter ("charset", b->parameter); - if (charset) + if (charset && Charset) cd = mutt_iconv_open (Charset, charset); } diff --git a/rfc2047.c b/rfc2047.c index 811a1e25..214240df 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -454,9 +454,10 @@ void rfc2047_encode_string (char **pd) size_t elen; char *charsets; + if (!Charset) + return; + charsets = SendCharset; - if (!charsets || !*charsets) - charsets = Charset; if (!charsets || !*charsets) charsets = "UTF-8"; diff --git a/sendlib.c b/sendlib.c index f43b63aa..3f4745cf 100644 --- a/sendlib.c +++ b/sendlib.c @@ -844,7 +844,8 @@ CONTENT *mutt_get_content_info (const char *fname, BODY *b) if (b != NULL && b->type == TYPETEXT && (!b->noconv)) { char *chs = mutt_get_parameter ("charset", b->parameter); - if (convert_file_from_to (fp, Charset, chs ? chs : SendCharset, + if (Charset && (chs || SendCharset) && + convert_file_from_to (fp, Charset, chs ? chs : SendCharset, &fromcode, &tocode, info) != (size_t)(-1)) { if (!chs)