From: Richard Russon Date: Mon, 18 Jun 2018 12:24:08 +0000 (+0100) Subject: coverity: fix defects X-Git-Tag: neomutt-20180622~9^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82994d3e950c3b76765ff8a9ecee33d230f27341;p=neomutt coverity: fix defects --- diff --git a/enriched.c b/enriched.c index f70e7fee5..585d145fd 100644 --- a/enriched.c +++ b/enriched.c @@ -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; diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index e75bcfe04..48eabab4b 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -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)