[openssl] master update
tomas at openssl.org
tomas at openssl.org
Fri Jul 23 07:06:38 UTC 2021
The branch master has been updated
via 40184c96103a388209939c1c19920971c05bb78c (commit)
from a983764e17551b2988bd684279ac9e9077d84601 (commit)
- Log -----------------------------------------------------------------
commit 40184c96103a388209939c1c19920971c05bb78c
Author: Tomas Mraz <tomas at openssl.org>
Date: Wed Jul 21 18:45:01 2021 +0200
DSA/RSA_print(): Fix potential memory leak
Fixes #10777
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16130)
-----------------------------------------------------------------------
Summary of changes:
crypto/dsa/dsa_prn.c | 12 ++++++++----
crypto/rsa/rsa_prn.c | 6 ++++--
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/crypto/dsa/dsa_prn.c b/crypto/dsa/dsa_prn.c
index c5ec7d5dfe..6f001a50f0 100644
--- a/crypto/dsa/dsa_prn.c
+++ b/crypto/dsa/dsa_prn.c
@@ -55,9 +55,11 @@ int DSA_print(BIO *bp, const DSA *x, int off)
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
- if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ if (pk == NULL)
return 0;
- ret = EVP_PKEY_print_private(bp, pk, off, NULL);
+ ret = EVP_PKEY_set1_DSA(pk, (DSA *)x);
+ if (ret)
+ ret = EVP_PKEY_print_private(bp, pk, off, NULL);
EVP_PKEY_free(pk);
return ret;
}
@@ -67,9 +69,11 @@ int DSAparams_print(BIO *bp, const DSA *x)
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
- if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ if (pk == NULL)
return 0;
- ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
+ ret = EVP_PKEY_set1_DSA(pk, (DSA *)x);
+ if (ret)
+ ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
EVP_PKEY_free(pk);
return ret;
}
diff --git a/crypto/rsa/rsa_prn.c b/crypto/rsa/rsa_prn.c
index 4a317dadc4..35723c87ae 100644
--- a/crypto/rsa/rsa_prn.c
+++ b/crypto/rsa/rsa_prn.c
@@ -40,9 +40,11 @@ int RSA_print(BIO *bp, const RSA *x, int off)
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
- if (pk == NULL || !EVP_PKEY_set1_RSA(pk, (RSA *)x))
+ if (pk == NULL)
return 0;
- ret = EVP_PKEY_print_private(bp, pk, off, NULL);
+ ret = EVP_PKEY_set1_RSA(pk, (RSA *)x);
+ if (ret)
+ ret = EVP_PKEY_print_private(bp, pk, off, NULL);
EVP_PKEY_free(pk);
return ret;
}
More information about the openssl-commits
mailing list