]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix Memory leak in CMS_EncryptedData_set1_key
authorRyan Hooper <ryhooper@cisco.com>
Thu, 25 Sep 2025 16:42:24 +0000 (12:42 -0400)
committerTomas Mraz <tomas@openssl.org>
Wed, 1 Oct 2025 15:49:39 +0000 (17:49 +0200)
commitb5ab449e26a0c716b48255c3f0e2d054fb441ad6
treef7580e793dae8ac854043fdffb9f4e4615c5cf58
parent7e69fe4a1057817b552e5e23a08899689236e0d8
Fix Memory leak in CMS_EncryptedData_set1_key

When CMS_EncryptedData_set1_key is called repeatedly it will
leak data on the second call. This was because
cms->d.encryptedData was already set and needed to be cleared
before the call to M_ASN1_new_of.

Fixes: #28606
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28668)

(cherry picked from commit 7de825efa26d136c7bb118156190437bdcf130b7)
crypto/cms/cms_enc.c
test/cmsapitest.c