Blame SOURCES/libgpg-error-1.42-coverity.patch

af0758
From 89a353f418f5e879ab5564ec0767a6cbdb19d51c Mon Sep 17 00:00:00 2001
af0758
From: NIIBE Yutaka <gniibe@fsij.org>
af0758
Date: Wed, 7 Apr 2021 16:59:35 +0900
af0758
Subject: [PATCH Libgpg-error 1/4] build: Fix gpgrt-config for handling
af0758
 'Requires' field.
af0758
af0758
* src/gpgrt-config.in (get_attr_l): Fix thinko for word split.
af0758
af0758
--
af0758
af0758
GnuPG-bug-id: 5381
af0758
Reported-by: Jakub Jelen <jjelen@redhat.com>
af0758
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
af0758
---
af0758
 src/gpgrt-config.in | 3 ++-
af0758
 1 file changed, 2 insertions(+), 1 deletion(-)
af0758
af0758
diff --git a/src/gpgrt-config.in b/src/gpgrt-config.in
af0758
index 0fe14e8..6352384 100644
af0758
--- a/src/gpgrt-config.in
af0758
+++ b/src/gpgrt-config.in
af0758
@@ -1,4 +1,5 @@
af0758
 #!@INSTALLSHELLPATH@
af0758
+#                          -*- mode: shell-script; sh-shell: "/bin/sh" -*-
af0758
 # Copyright (C) 2018, 2021 g10 Code GmbH
af0758
 #
af0758
 # This file is free software; as a special exception the author gives
af0758
@@ -41,7 +42,7 @@ get_attr () {
af0758
 
af0758
 # variant of get_attr for list (separated by ',')
af0758
 get_attr_l () {
af0758
-    (IFS=', '; for x in "$(get_attr $1)"; do echo $x; done)
af0758
+    (IFS=', '; echo "$(get_attr $1)")
af0758
 }
af0758
 
af0758
 # Remove ${varname} part in the beginning of a string.
af0758
-- 
af0758
2.30.2
af0758
af0758
af0758
From 956c40f106ead6d0191bc183805021e70c15e760 Mon Sep 17 00:00:00 2001
af0758
From: NIIBE Yutaka <gniibe@fsij.org>
af0758
Date: Thu, 8 Apr 2021 10:58:56 +0900
af0758
Subject: [PATCH Libgpg-error 2/4] core: Fix gpgrt_wait_processes, by skipping
af0758
 invalid PID.
af0758
af0758
* src/spawn-posix.c (_gpgrt_wait_processes): Skip invalid PID.
af0758
af0758
--
af0758
af0758
The API itself is not good to handle multiple processes.  Given the
af0758
API, skipping invalid PID is better for usefulness.
af0758
af0758
GnuPG-bug-id: 5381
af0758
Reported-by: Jakub Jelen <jjelen@redhat.com>
af0758
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
af0758
---
af0758
 src/spawn-posix.c | 7 ++++++-
af0758
 1 file changed, 6 insertions(+), 1 deletion(-)
af0758
af0758
diff --git a/src/spawn-posix.c b/src/spawn-posix.c
af0758
index ac4c4ce..d33bade 100644
af0758
--- a/src/spawn-posix.c
af0758
+++ b/src/spawn-posix.c
af0758
@@ -703,8 +703,13 @@ _gpgrt_wait_processes (const char **pgmnames, pid_t *pids, size_t count,
af0758
     {
af0758
       int status = -1;
af0758
 
af0758
+      /* Skip invalid PID.  */
af0758
       if (pids[i] == (pid_t)(-1))
af0758
-        return GPG_ERR_INV_VALUE;
af0758
+        {
af0758
+          r_exitcodes[i] = -1;
af0758
+          left -= 1;
af0758
+          continue;
af0758
+        }
af0758
 
af0758
       /* See if there was a previously stored result for this pid.  */
af0758
       if (get_result (pids[i], &status))
af0758
-- 
af0758
2.30.2
af0758
af0758
af0758
From ad062b0a5b7d598081405ecfb71b51540281a1b7 Mon Sep 17 00:00:00 2001
af0758
From: Jakub Jelen <jjelen@redhat.com>
af0758
Date: Mon, 12 Apr 2021 13:06:17 +0900
af0758
Subject: [PATCH Libgpg-error 3/4] build,tests: Fix leaks of memory or file
af0758
 pointer.
af0758
af0758
* src/mkheader.c (parse_config_h): Close FP.
af0758
* tests/t-b64.c (test_b64enc_string): Free STATE.
af0758
(test_b64dec_string): Free BUFFER.
af0758
* tests/t-syserror.c (main): Close FP.
af0758
af0758
--
af0758
af0758
GnuPG-bug-id: 5381
af0758
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
af0758
---
af0758
 src/mkheader.c     | 1 +
af0758
 tests/t-b64.c      | 2 ++
af0758
 tests/t-syserror.c | 1 +
af0758
 3 files changed, 4 insertions(+)
af0758
af0758
diff --git a/src/mkheader.c b/src/mkheader.c
af0758
index 77826da..1d2ea20 100644
af0758
--- a/src/mkheader.c
af0758
+++ b/src/mkheader.c
af0758
@@ -244,6 +244,7 @@ parse_config_h (const char *fname)
af0758
     {
af0758
       fprintf (stderr, "%s:%d: error reading file: %s\n",
af0758
                fname, lnr, strerror (errno));
af0758
+      fclose (fp);
af0758
       return 1;
af0758
     }
af0758
 
af0758
diff --git a/tests/t-b64.c b/tests/t-b64.c
af0758
index 0171909..db08fc0 100644
af0758
--- a/tests/t-b64.c
af0758
+++ b/tests/t-b64.c
af0758
@@ -108,6 +108,7 @@ test_b64enc_string (const char *string, const char *expected, const char *title)
af0758
   err = gpgrt_b64enc_write (state, string, strlen (string));
af0758
   if (err)
af0758
     {
af0758
+      free (state);
af0758
       fail ("gpgrt_b64enc_write failed: %s\n", gpg_strerror (err));
af0758
       return err;
af0758
     }
af0758
@@ -191,6 +192,7 @@ test_b64dec_string (const char *string, const char *expected, const char *title)
af0758
           gpgrt_log_debug_string (expected, "expect(len=%zu): ",
af0758
                                   strlen (expected));
af0758
         }
af0758
+      free (buffer);
af0758
       return GPG_ERR_FALSE;
af0758
     }
af0758
 
af0758
diff --git a/tests/t-syserror.c b/tests/t-syserror.c
af0758
index a4cb983..93264dd 100644
af0758
--- a/tests/t-syserror.c
af0758
+++ b/tests/t-syserror.c
af0758
@@ -49,6 +49,7 @@ main (int argc, char *argv[])
af0758
     }
af0758
   if (fp)
af0758
     {
af0758
+      fclose (fp);
af0758
       fprintf (stderr, "unable to run test\n");
af0758
       return 1;
af0758
     }
af0758
-- 
af0758
2.30.2
af0758
af0758
af0758
From 5e60ba508a2b23aa73a9b26616e1dd3f1fc1cb7d Mon Sep 17 00:00:00 2001
af0758
From: Jakub Jelen <jjelen@redhat.com>
af0758
Date: Wed, 7 Apr 2021 11:56:40 +0200
af0758
Subject: [PATCH Libgpg-error 4/4] logging: Supress cppcheck warning
af0758
af0758
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
af0758
---
af0758
 src/logging.c | 1 +
af0758
 1 file changed, 1 insertion(+)
af0758
af0758
diff --git a/src/logging.c b/src/logging.c
af0758
index e4b7e40..69bf8c5 100644
af0758
--- a/src/logging.c
af0758
+++ b/src/logging.c
af0758
@@ -1274,6 +1274,7 @@ _gpgrt_log_printhex (const void *buffer, size_t length,
af0758
        * complains about uninitialized use.  */
af0758
       static va_list dummy_argptr;
af0758
 
af0758
+      // cppcheck-suppress va_list_usedBeforeStarted
af0758
       _gpgrt_logv_printhex (buffer, length, NULL, dummy_argptr);
af0758
     }
af0758
 }
af0758
-- 
af0758
2.30.2
af0758