[git] GnuPG - branch, master, updated. gnupg-2.1.15-127-g18bbefa

by Werner Koch cvs at cvs.gnupg.org
Mon Sep 19 08:31:08 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  18bbefa27f9e47e1062ee4d7af09487632795ba7 (commit)
      from  55675fa5a03969a896c8a7b19af22a2fd91d9747 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 18bbefa27f9e47e1062ee4d7af09487632795ba7
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Sep 19 08:27:23 2016 +0200

    gpg: Avoid malloc failure due to no key signatures
    
    * g10/keyedit.c (check_all_keysigs): Check early for no key
    signatures.  Use xtrycalloc.
    --
    
    GnuPG-bug-id: 2690
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keyedit.c b/g10/keyedit.c
index 87e69b0..cd16ec9 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -408,20 +408,31 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
 
   /* First we look for duplicates.  */
   {
-    int nsigs = 0;
-    KBNODE *sigs;
+    int nsigs;
+    kbnode_t *sigs;
     int i;
     int last_i;
 
     /* Count the sigs.  */
-    for (n = kb; n; n = n->next)
-      if (is_deleted_kbnode (n))
-        continue;
-      else if (n->pkt->pkttype == PKT_SIGNATURE)
-        nsigs ++;
+    for (nsigs = 0, n = kb; n; n = n->next)
+      {
+        if (is_deleted_kbnode (n))
+          continue;
+        else if (n->pkt->pkttype == PKT_SIGNATURE)
+          nsigs ++;
+      }
+
+    if (!nsigs)
+      return 0; /* No signatures at all.  */
 
     /* Add them all to the SIGS array.  */
-    sigs = xmalloc_clear (sizeof (*sigs) * nsigs);
+    sigs = xtrycalloc (nsigs, sizeof *sigs);
+    if (!sigs)
+      {
+        log_error (_("error allocating memory: %s\n"),
+                   gpg_strerror (gpg_error_from_syserror ()));
+        return 0;
+      }
 
     i = 0;
     for (n = kb; n; n = n->next)

-----------------------------------------------------------------------

Summary of changes:
 g10/keyedit.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list