]> granicus.if.org Git - neomutt/commitdiff
coverity: fix defects
authorRichard Russon <rich@flatcap.org>
Mon, 18 Jun 2018 12:24:08 +0000 (13:24 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 18 Jun 2018 23:35:37 +0000 (00:35 +0100)
enriched.c
ncrypt/pgp.c

index f70e7fee5987fd782ee4d6fc4132562842e2d0a6..585d145fd0a4e873d6cca23d803111c9c6e6c629 100644 (file)
@@ -115,6 +115,9 @@ struct EnrichedState
  */
 static void enriched_wrap(struct EnrichedState *stte)
 {
+  if (!stte)
+    return;
+
   int x;
 
   if (stte->line_len)
@@ -227,6 +230,9 @@ static void enriched_wrap(struct EnrichedState *stte)
  */
 static void enriched_flush(struct EnrichedState *stte, bool wrap)
 {
+  if (!stte)
+    return;
+
   if (!stte->tag_level[RICH_NOFILL] &&
       ((stte->line_len + stte->word_len) >
        (stte->wrap_margin - (stte->tag_level[RICH_INDENT_RIGHT] * INDENT_SIZE) - stte->indent_len)))
@@ -260,6 +266,9 @@ static void enriched_flush(struct EnrichedState *stte, bool wrap)
  */
 static void enriched_putwc(wchar_t c, struct EnrichedState *stte)
 {
+  if (!stte)
+    return;
+
   if (stte->tag_level[RICH_PARAM])
   {
     if (stte->tag_level[RICH_COLOR])
@@ -331,6 +340,9 @@ static void enriched_putwc(wchar_t c, struct EnrichedState *stte)
  */
 static void enriched_puts(const char *s, struct EnrichedState *stte)
 {
+  if (!stte)
+    return;
+
   const char *c = NULL;
 
   if (stte->buf_len < (stte->buf_used + mutt_str_strlen(s)))
@@ -353,6 +365,9 @@ static void enriched_puts(const char *s, struct EnrichedState *stte)
  */
 static void enriched_set_flags(const wchar_t *tag, struct EnrichedState *stte)
 {
+  if (!stte)
+    return;
+
   const wchar_t *tagptr = tag;
   int i, j;
 
index e75bcfe04e8f8ecb670751e7819bb60ea84e91b4..48eabab4b5e5adeb73119df3dd17b159e66c1045 100644 (file)
@@ -190,6 +190,9 @@ char *pgp_fpr_or_lkeyid(struct PgpKeyInfo *k)
  */
 static int pgp_copy_checksig(FILE *fpin, FILE *fpout)
 {
+  if (!fpin || !fpout)
+    return -1;
+
   int rc = -1;
 
   if (PgpGoodSign && PgpGoodSign->regex)