]> 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:22 +0000 (17:49 +0200)
commit478aaf55f7f9831aa5f965f216f0b9bb10a08d60
treec7ad34fde2b3694adbfcddf42499a2fba9412b45
parenta9ecb75daaf9a2b2b0ed2addb5850e1645f25839
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