Skip to content

Commit eb7ebfa

Browse files
Validate IV length in the non-streaming path in wc_PKCS7_DecodeEnvelopedData.
Reported by: Jorge Milla (Pig-Tail) <jorge@jmilla.es>
1 parent 6409a9e commit eb7ebfa

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
@@ -13611,6 +13611,12 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1361113611
break;
1361213612
}
1361313613
#else
13614+
/* ensure IV bytes are within the input buffer before copying */
13615+
if (length < 0 || (word32)length > pkiMsgSz ||
13616+
idx > pkiMsgSz - (word32)length) {
13617+
ret = BUFFER_E;
13618+
break;
13619+
}
1361413620
ret = 0;
1361513621
#endif
1361613622

0 commit comments

Comments
 (0)