From: markus schnalke Date: Sat, 14 Apr 2012 20:09:52 +0000 (+0200) Subject: mhshow: Fixed segfault. (Care that c_charset is set.) X-Git-Tag: mmh-thesis-end~79 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=2017eab468c8506da64eacc01d829c2b946e5faa;p=mmh mhshow: Fixed segfault. (Care that c_charset is set.) --- diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 3bcf84f..4f67d32 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -312,9 +312,8 @@ show_content_aux(CT ct, int alternate, char *cp, char *cracked) case 'c': /* insert charset */ - if (ct->c_charset) { - strncpy(bp, ct->c_charset, buflen); - } + strncpy(bp, ct->c_charset ? ct->c_charset : + "US-ASCII", buflen); break; case 'd': @@ -513,7 +512,8 @@ show_text(CT ct, int alternate) ** if it is not a text part of a multipart/alternative */ if (!alternate || ct->c_subtype == TEXT_PLAIN) { - if (!check_charset(ct->c_charset, strlen(ct->c_charset))) { + if (ct->c_charset && !check_charset(ct->c_charset, + strlen(ct->c_charset))) { snprintf(buffer, sizeof(buffer), "%%liconv -f '%s'", ct->c_charset); } else { @@ -714,9 +714,8 @@ show_multi_aux(CT ct, int alternate, char *cp) case 'c': /* insert charset */ - if (ct->c_charset) { - strncpy(bp, ct->c_charset, buflen); - } + strncpy(bp, ct->c_charset ? ct->c_charset : + "US-ASCII", buflen); break; case 'd':