diff options
author | jsing <> | 2019-10-31 12:32:48 +0000 |
---|---|---|
committer | jsing <> | 2019-10-31 12:32:48 +0000 |
commit | a525aacb816cb1ca3a962ccd2b93bd1cf0cb070a (patch) | |
tree | 3ac47782203496a1958c74068ecc6a622b6d7c9b /src/lib | |
parent | c52b47e979edc93be5adaf4ad25c5966262fc922 (diff) | |
download | openbsd-a525aacb816cb1ca3a962ccd2b93bd1cf0cb070a.tar.gz openbsd-a525aacb816cb1ca3a962ccd2b93bd1cf0cb070a.tar.bz2 openbsd-a525aacb816cb1ca3a962ccd2b93bd1cf0cb070a.zip |
Avoid potentially leaking pub_exp in pkey_rsa_copy().
ok inoguchi@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_pmeth.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 78f6532a5f..fd567658c2 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.24 2019/10/29 08:52:02 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.25 2019/10/31 12:32:48 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -127,9 +127,9 @@ pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
127 | sctx = src->data; | 127 | sctx = src->data; |
128 | dctx = dst->data; | 128 | dctx = dst->data; |
129 | dctx->nbits = sctx->nbits; | 129 | dctx->nbits = sctx->nbits; |
130 | if (sctx->pub_exp) { | 130 | if (sctx->pub_exp != NULL) { |
131 | dctx->pub_exp = BN_dup(sctx->pub_exp); | 131 | BN_free(dctx->pub_exp); |
132 | if (!dctx->pub_exp) | 132 | if ((dctx->pub_exp = BN_dup(sctx->pub_exp)) == NULL) |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | dctx->pad_mode = sctx->pad_mode; | 135 | dctx->pad_mode = sctx->pad_mode; |