]> granicus.if.org Git - neomutt/commitdiff
fix pointer checks in rfc2047_decode()
authorRichard Russon <rich@flatcap.org>
Thu, 19 Sep 2019 22:41:12 +0000 (23:41 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 21 Sep 2019 17:09:08 +0000 (18:09 +0100)
email/rfc2047.c

index 0fdaa634cae37dc08670053556a75227b5b1677a..d1c94575d78d0e7289269852415b9e13ec56f596 100644 (file)
@@ -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 */