diff options
author | Werner Koch <[email protected]> | 2014-09-08 17:26:02 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-09-08 17:26:02 +0000 |
commit | 64329cce9a0f21cf941ff2c3f542a08c57cb5378 (patch) | |
tree | 2757f807c51b06645bff08cb9c85c72e49b151d9 /g10/export.c | |
parent | gpg: Do not show "MD5" and triplicated "RSA" in --version. (diff) | |
parent | gpg: Fix memory leak in ECC encryption. (diff) | |
download | gnupg-64329cce9a0f21cf941ff2c3f542a08c57cb5378.tar.gz gnupg-64329cce9a0f21cf941ff2c3f542a08c57cb5378.zip |
Merge branch 'wk/test-gpgrt-estream'
Diffstat (limited to 'g10/export.c')
-rw-r--r-- | g10/export.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/g10/export.c b/g10/export.c index 6a921c192..b4f1a2e4d 100644 --- a/g10/export.c +++ b/g10/export.c @@ -462,7 +462,7 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk) xfree (string); string = NULL; if (gcry_pk_algo_info (pk_algo, GCRYCTL_GET_ALGO_NPKEY, NULL, &npkey) || gcry_pk_algo_info (pk_algo, GCRYCTL_GET_ALGO_NSKEY, NULL, &nskey) - || !npkey || npkey >= nskey || nskey > PUBKEY_MAX_NSKEY) + || !npkey || npkey >= nskey) goto bad_seckey; /* Check that the pubkey algo matches the one from the public key. */ @@ -503,6 +503,10 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk) goto leave; } + /* This check has to go after the ecc adjustments. */ + if (nskey > PUBKEY_MAX_NSKEY) + goto bad_seckey; + /* Parse the key parameters. */ gcry_sexp_release (list); list = gcry_sexp_find_token (top_list, "skey", 0); |