Skip to content

Commit 3ff6491

Browse files
igus68t8m
authored andcommitted
Fix potential NULL dereference processing CMS PasswordRecipientInfo
Avoid NULL dereferencing when keyDerivationAlgorithm is absent in CMS PasswordRecipientInfo. Fixes CVE-2026-42766 Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Mon Jun 8 18:57:52 2026 (cherry picked from commit f019b72c589071a73acda9812775389a857884c9)
1 parent f48adad commit 3ff6491

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

crypto/cms/cms_pwri.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ int ossl_cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms,
354354

355355
/* Finish password based key derivation to setup key in "ctx" */
356356

357+
if (algtmp == NULL) {
358+
ERR_raise_data(ERR_LIB_CMS, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER,
359+
"Missing KeyDerivationAlgorithm");
360+
goto err;
361+
}
357362
if (!EVP_PBE_CipherInit_ex(algtmp->algorithm,
358363
(char *)pwri->pass, (int)pwri->passlen,
359364
algtmp->parameter, kekctx, en_de,

0 commit comments

Comments
 (0)