mirror of
https://github.com/openssl/openssl.git
synced 2024-12-09 05:51:54 +08:00
Fix a use after free in error handling of hmac_dup
dst->digest needs to be zeroized in case HMAC_CTX_copy or ossl_prov_digest_copy return failure. Fixes #18493 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18502)
This commit is contained in:
parent
ee11118deb
commit
cec1699f1f
@ -115,6 +115,7 @@ static void *hmac_dup(void *vsrc)
|
||||
*dst = *src;
|
||||
dst->ctx = ctx;
|
||||
dst->key = NULL;
|
||||
memset(&dst->digest, 0, sizeof(dst->digest));
|
||||
|
||||
if (!HMAC_CTX_copy(dst->ctx, src->ctx)
|
||||
|| !ossl_prov_digest_copy(&dst->digest, &src->digest)) {
|
||||
|
Loading…
Reference in New Issue
Block a user