From 42e4d81fb40d527cc4ea9c673fa24e8cf23ef4b4 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 19 Sep 2019 23:41:12 +0100 Subject: [PATCH] fix pointer checks in rfc2047_decode() --- email/rfc2047.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/email/rfc2047.c b/email/rfc2047.c index 0fdaa634c..d1c94575d 100644 --- a/email/rfc2047.c +++ b/email/rfc2047.c @@ -346,6 +346,8 @@ static size_t choose_block(char *d, size_t dlen, int col, const char *fromcode, */ static void finalize_chunk(struct Buffer *res, struct Buffer *buf, char *charset, size_t charsetlen) { + if (!charset) + return; char end = charset[charsetlen]; charset[charsetlen] = '\0'; mutt_ch_convert_string(&buf->data, charset, C_Charset, MUTT_ICONV_HOOK_FROM); @@ -714,7 +716,7 @@ void rfc2047_decode(char **pd) return; } if (prev.data && ((prev_charsetlen != charsetlen) || - (strncmp(prev_charset, charset, charsetlen) != 0))) + (mutt_str_strncmp(prev_charset, charset, charsetlen) != 0))) { /* Different charset, convert the previous chunk and add it to the * final result */ -- 2.40.0