Skip to content

Commit 3540d89

Browse files
authored
Merge pull request #9945 from holtrop-wolfssl/zd21327
Avoid one-byte read outside of allocated encrypted content buffer in wc_PKCS7_DecodeEnvelopedData()
2 parents a5bc0cd + d37b51c commit 3540d89

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

wolfcrypt/src/pkcs7.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13219,6 +13219,12 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1321913219
/* use cached content */
1322013220
encryptedContent = pkcs7->cachedEncryptedContent;
1322113221
encryptedContentSz = (int)pkcs7->cachedEncryptedContentSz;
13222+
13223+
if (encryptedContentSz <= 0) {
13224+
ret = BUFFER_E;
13225+
break;
13226+
}
13227+
1322213228
padLen = encryptedContent[encryptedContentSz-1];
1322313229

1322413230
/* copy plaintext to output */

0 commit comments

Comments
 (0)