summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-06-08 17:48:39 +0200
committerTomas Mraz <tomas@openssl.org>2022-06-10 14:08:59 +0200
commitcf3bf39f142369f2a8000f33f18b7d9b599fcddb (patch)
tree7bda4ee3efd1c47bf1ca2f517edf9c196c6459b0 /providers
parente10ebdd81e6f5b6eb00fb25476bbd8cc19c9c83c (diff)
sm2_dupctx: Avoid potential use after free of the md
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18494) (cherry picked from commit 926c698c6f0a197e0322d4617db0ecd0d40f6e06)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/asymciphers/sm2_enc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/providers/implementations/asymciphers/sm2_enc.c b/providers/implementations/asymciphers/sm2_enc.c
index 9577d16e83..ddb2cfc14a 100644
--- a/providers/implementations/asymciphers/sm2_enc.c
+++ b/providers/implementations/asymciphers/sm2_enc.c
@@ -138,6 +138,8 @@ static void *sm2_dupctx(void *vpsm2ctx)
return NULL;
*dstctx = *srcctx;
+ memset(&dstctx->md, 0, sizeof(dstctx->md));
+
if (dstctx->key != NULL && !EC_KEY_up_ref(dstctx->key)) {
OPENSSL_free(dstctx);
return NULL;