From 2017eab468c8506da64eacc01d829c2b946e5faa Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 14 Apr 2012 22:09:52 +0200 Subject: [PATCH] mhshow: Fixed segfault. (Care that c_charset is set.) --- uip/mhshowsbr.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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': -- 1.7.10.4