[Pkg-gnupg-commit] [gnupg2] 90/205: g10: Guard code against errors.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:21 UTC 2016


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

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 40f6529ceeea806fc011135a9fa3a3590a9534ac
Author: Justus Winter <justus at g10code.com>
Date:   Fri Mar 4 13:29:45 2016 +0100

    g10: Guard code against errors.
    
    * g10/keygen.c (do_generate_keypair): Check for errors, in which case
    'pri_psk' is NULL.
    
    Fixes-commit: bf9d1248
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 g10/keygen.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/g10/keygen.c b/g10/keygen.c
index 8f25fe9..1cf8648 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -4077,14 +4077,15 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
     {
       pri_psk = pub_root->next->pkt->pkt.public_key;
       assert (pri_psk);
-    }
 
-  /* Make sure a few fields are correctly set up before going further.  */
-  pri_psk->flags.primary = 1;
-  keyid_from_pk (pri_psk, NULL);
-  /* We don't use pk_keyid to get keyid, because it also asserts that
-     main_keyid is set!  */
-  keyid_copy (pri_psk->main_keyid, pri_psk->keyid);
+      /* Make sure a few fields are correctly set up before going
+         further.  */
+      pri_psk->flags.primary = 1;
+      keyid_from_pk (pri_psk, NULL);
+      /* We don't use pk_keyid to get keyid, because it also asserts
+         that main_keyid is set!  */
+      keyid_copy (pri_psk->main_keyid, pri_psk->keyid);
+    }
 
   if (!err && (revkey = get_parameter_revkey (para, pREVOKER)))
     err = write_direct_sig (pub_root, pri_psk, revkey, timestamp, cache_nonce);

-- 
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