diff options
author | Werner Koch <wk@gnupg.org> | 2021-05-11 09:04:19 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2021-05-11 09:06:34 +0200 |
commit | 965bb0693c0df04e6dbd57a8b471944367cf6c4e (patch) | |
tree | 3d038894faf6e52c451d2a58cccfca0766b2b2be /g10 | |
parent | gpg: Fix allocation for EXTRAHASH. (diff) | |
download | gnupg2-965bb0693c0df04e6dbd57a8b471944367cf6c4e.tar.xz gnupg2-965bb0693c0df04e6dbd57a8b471944367cf6c4e.zip |
A few minor code cleanups and typo fixes.
* agent/command-ssh.c (ssh_handler_request_identities): Remove double
check of ERR.
* g10/getkey.c (get_pubkey_byname): Remove double use of break.
* g10/pkglue.c (pk_encrypt): Handle possible NULL-ptr access due to
failed malloc.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r-- | g10/getkey.c | 2 | ||||
-rw-r--r-- | g10/pkglue.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/g10/getkey.c b/g10/getkey.c index 9c5a00555..c0f8b7c54 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1164,7 +1164,6 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode, { mechanism_string = ""; rc = GPG_ERR_NO_PUBKEY; - break; } else { @@ -1180,7 +1179,6 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode, { mechanism_string = ""; rc = GPG_ERR_NO_PUBKEY; - break; } else { diff --git a/g10/pkglue.c b/g10/pkglue.c index cab007f01..1e0191e12 100644 --- a/g10/pkglue.c +++ b/g10/pkglue.c @@ -424,6 +424,11 @@ pk_encrypt (pubkey_algo_t algo, gcry_mpi_t *resarr, gcry_mpi_t data, /* Get the shared point and the ephemeral public key. */ shared = get_data_from_sexp (s_ciph, "s", &nshared); + if (!shared) + { + rc = gpg_error_from_syserror (); + goto leave; + } rc = sexp_extract_param_sos (s_ciph, "e", &public); gcry_sexp_release (s_ciph); s_ciph = NULL; @@ -464,6 +469,7 @@ pk_encrypt (pubkey_algo_t algo, gcry_mpi_t *resarr, gcry_mpi_t data, resarr[1] = get_mpi_from_sexp (s_ciph, "b", GCRYMPI_FMT_USG); } + leave: gcry_sexp_release (s_ciph); return rc; } |