Skip to content

Commit 1397268

Browse files
In wc_PKCS7_DecodeEnvelopedData, confirm encryptedContentTotalSz does not exceed the total message size before using it in the non-streaming case.
Thanks to Zou Dikai for the report.
1 parent 7f21857 commit 1397268

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

wolfcrypt/src/pkcs7.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13242,6 +13242,11 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1324213242
}
1324313243
wc_PKCS7_DecryptContentFree(pkcs7, encOID, pkcs7->heap);
1324413244
} else {
13245+
if ((idx + (word32)encryptedContentTotalSz) > pkiMsgSz) {
13246+
ret = BUFFER_E;
13247+
break;
13248+
}
13249+
1324513250
pkcs7->cachedEncryptedContentSz =
1324613251
(word32)encryptedContentTotalSz;
1324713252
pkcs7->totalEncryptedContentSz =

0 commit comments

Comments
 (0)