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>
This commit is contained in:
Werner Koch 2021-05-11 09:04:19 +02:00
parent ac731dbbbd
commit 965bb0693c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
6 changed files with 10 additions and 5 deletions

2
README
View File

@ -1,6 +1,6 @@
The GNU Privacy Guard 2 The GNU Privacy Guard 2
========================= =========================
Version 2.3 (devel) Version 2.3
Copyright 1997-2019 Werner Koch Copyright 1997-2019 Werner Koch
Copyright 1998-2021 Free Software Foundation, Inc. Copyright 1998-2021 Free Software Foundation, Inc.

View File

@ -2518,7 +2518,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
xfree (cardsn); xfree (cardsn);
if (err) if (err)
{ {
if (err && opt.verbose) if (opt.verbose)
gcry_log_debugsxp ("pubkey", key_public); gcry_log_debugsxp ("pubkey", key_public);
if (gpg_err_code (err) == GPG_ERR_UNKNOWN_CURVE if (gpg_err_code (err) == GPG_ERR_UNKNOWN_CURVE
|| gpg_err_code (err) == GPG_ERR_INV_CURVE) || gpg_err_code (err) == GPG_ERR_INV_CURVE)

View File

@ -1666,6 +1666,7 @@ Description of some debug flags:
- RFC-3447 :: PKCS #1: RSA Cryptography Specifications Version 2.1 - RFC-3447 :: PKCS #1: RSA Cryptography Specifications Version 2.1
- RFC-4880 :: OpenPGP - RFC-4880 :: OpenPGP
- RFC-5280 :: X.509 PKI Certificate and CRL Profile - RFC-5280 :: X.509 PKI Certificate and CRL Profile
- RFC-5652 :: CMS (STD0070)
- RFC-6818 :: Updates to the X.509 PKI Certificate and CRL Profile - RFC-6818 :: Updates to the X.509 PKI Certificate and CRL Profile
- RFC-8398 :: Internationalized Email Addresses in X.509 Certificates. - RFC-8398 :: Internationalized Email Addresses in X.509 Certificates.
- RFC-8399 :: Internationalization Updates to RFC 5280 - RFC-8399 :: Internationalization Updates to RFC 5280

View File

@ -1164,7 +1164,6 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
{ {
mechanism_string = ""; mechanism_string = "";
rc = GPG_ERR_NO_PUBKEY; rc = GPG_ERR_NO_PUBKEY;
break;
} }
else else
{ {
@ -1180,7 +1179,6 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
{ {
mechanism_string = ""; mechanism_string = "";
rc = GPG_ERR_NO_PUBKEY; rc = GPG_ERR_NO_PUBKEY;
break;
} }
else else
{ {

View File

@ -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. */ /* Get the shared point and the ephemeral public key. */
shared = get_data_from_sexp (s_ciph, "s", &nshared); 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); rc = sexp_extract_param_sos (s_ciph, "e", &public);
gcry_sexp_release (s_ciph); gcry_sexp_release (s_ciph);
s_ciph = NULL; 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); resarr[1] = get_mpi_from_sexp (s_ciph, "b", GCRYMPI_FMT_USG);
} }
leave:
gcry_sexp_release (s_ciph); gcry_sexp_release (s_ciph);
return rc; return rc;
} }

View File

@ -45,7 +45,7 @@
/* Flags used by the app_write_learn_status. */ /* Flags used by the app_write_learn_status. */
#define APP_LEARN_FLAG_KEYPAIRINFO 1 /* Return only keypair infos. */ #define APP_LEARN_FLAG_KEYPAIRINFO 1 /* Return only keypair infos. */
#define APP_LEARN_FLAG_MULTI 2 /* Return info for all apps. */ #define APP_LEARN_FLAG_MULTI 2 /* Return info for all apps. */
#define APP_LEARN_FLAG_REREAD 4 /* Re-read ifnos from the token. */ #define APP_LEARN_FLAG_REREAD 4 /* Re-read infos from the token. */
/* List of supported card types. Generic is the usual ISO7817-4 /* List of supported card types. Generic is the usual ISO7817-4