Skip to content

Commit d37b51c

Browse files
Avoid one-byte read outside of allocated encrypted content buffer in wc_PKCS7_DecodeEnvelopedData()
1 parent b02ddde commit d37b51c

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
@@ -13221,6 +13221,12 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1322113221
/* use cached content */
1322213222
encryptedContent = pkcs7->cachedEncryptedContent;
1322313223
encryptedContentSz = (int)pkcs7->cachedEncryptedContentSz;
13224+
13225+
if (encryptedContentSz <= 0) {
13226+
ret = BUFFER_E;
13227+
break;
13228+
}
13229+
1322413230
padLen = encryptedContent[encryptedContentSz-1];
1322513231

1322613232
/* copy plaintext to output */

0 commit comments

Comments
 (0)