mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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@g10code.com>
This commit is contained in:
parent
8daf9a027f
commit
40f6529cee
15
g10/keygen.c
15
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user