[Pkg-gnupg-commit] [gnupg2] 66/180: gpg: Fix portability problem.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit c3008bffac68b6f31e9ae9bad837cdce5de7c0db
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Dec 8 13:06:10 2016 +0100

    gpg: Fix portability problem.
    
    * g10/tofu.c (build_conflict_set): Replace variable dynamic array.
    --
    
    Note that clang complained that CONFLICT_SET_COUNT could be negative.
    Thus I added an assert.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g10/tofu.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/g10/tofu.c b/g10/tofu.c
index 5b3e84c..d095bce 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -2227,9 +2227,15 @@ build_conflict_set (tofu_dbs_t dbs,
     int j;
     strlist_t *prevp;
     strlist_t iter_next;
-    int die[conflict_set_count];
+    int *die;
 
-    memset (die, 0, sizeof (die));
+    log_assert (conflict_set_count > 0);
+    die = xtrycalloc (1, conflict_set_count);
+    if (!die)
+      {
+        /*err = gpg_error_from_syserror ();*/
+        xoutofcore (); /* Fixme: Let the fucntion return an error.  */
+      }
 
     for (i = 0; i < conflict_set_count; i ++)
       {
@@ -2269,6 +2275,7 @@ build_conflict_set (tofu_dbs_t dbs,
     /* We shouldn't have removed the head.  */
     log_assert (conflict_set);
     log_assert (conflict_set_count >= 1);
+    xfree (die);
   }
   xfree (kb_all);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list