]> granicus.if.org Git - neomutt/commitdiff
coverity: minor fixes 515/head
authorRichard Russon <rich@flatcap.org>
Wed, 5 Apr 2017 14:59:15 +0000 (15:59 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 10 Apr 2017 13:32:13 +0000 (14:32 +0100)
Fix a few minor bugs.

curs_lib.c
pgppacket.c
pgppubring.c
rfc2047.c
system.c

index 5ed7559b188157f52a80538dd0267516a658714a..65f95b29fbd0047aa7a504e4e075634cc6574689 100644 (file)
@@ -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,
index ffaccfbc90fd010e09d61c2fa5421b2e8e2b739c..7c585098b8ce9c0dd0ab4b6c1b61e3085f4dd15e 100644 (file)
@@ -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];
index 5d152db25d545fda32e13b278e5d8d89a8c910b2..ad04bb8bfd3e1ff400aed446e2e14ecb3a0181e8 100644 (file)
@@ -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
index e24ec735fd5bf492a6ec8afb7e84ca9baf5cc2d6..604067f4809f02a54205b4cf5ca78703212ea6b5 100644 (file)
--- 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)
   {
index 47a6051f0971326f1343f84647546891d6429cad..beebd8c49980082ebaa64afb0ce73f3bf4ecb313 100644 (file)
--- 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;