From c429f39310d99ba2fc2884f1f3f4b99ce9854754 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Wed, 5 Apr 2017 15:59:15 +0100 Subject: [PATCH] coverity: minor fixes Fix a few minor bugs. --- curs_lib.c | 2 +- pgppacket.c | 2 +- pgppubring.c | 2 +- rfc2047.c | 2 +- system.c | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/curs_lib.c b/curs_lib.c index 5ed7559b1..65f95b29f 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -785,7 +785,7 @@ int mutt_any_key_to_continue (const char *s) close (f); fputs ("\r\n", stdout); mutt_clear_error (); - return ch; + return (ch >= 0) ? ch : EOF; } int mutt_do_pager (const char *banner, diff --git a/pgppacket.c b/pgppacket.c index ffaccfbc9..7c585098b 100644 --- a/pgppacket.c +++ b/pgppacket.c @@ -138,7 +138,7 @@ unsigned char *pgp_read_packet (FILE * fp, size_t * len) perror ("fread"); goto bail; } - material = buf[0] << 24; + material = (size_t) buf[0] << 24; material |= buf[1] << 16; material |= buf[2] << 8; material |= buf[3]; diff --git a/pgppubring.c b/pgppubring.c index 5d152db25..ad04bb8bf 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -640,7 +640,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) unsigned char *buff = NULL; unsigned char pt = 0; unsigned char last_pt; - size_t l; + size_t l = 0; short err = 0; #ifdef HAVE_FGETPOS diff --git a/rfc2047.c b/rfc2047.c index e24ec735f..604067f48 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -615,7 +615,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) char *charset = NULL; int rv = -1; - pd = d0 = safe_malloc (strlen (s)); + pd = d0 = safe_malloc (strlen (s) + 1); for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) { diff --git a/system.c b/system.c index 47a6051f0..beebd8c49 100644 --- a/system.c +++ b/system.c @@ -91,6 +91,7 @@ int _mutt_system (const char *cmd, int flags) #endif chdir ("/"); act.sa_handler = SIG_DFL; + sigemptyset (&act.sa_mask); sigaction (SIGCHLD, &act, NULL); break; -- 2.40.0