mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
sanity check on pkcs7 input size (#4386)
This commit is contained in:
@@ -4276,6 +4276,11 @@ static int wc_PKCS7_ParseSignerInfo(PKCS7* pkcs7, byte* in, word32 inSz,
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
if (length > (int)inSz - (int)idx)
|
||||
ret = BUFFER_E;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_PKCS7_SignerInfoSetSID(pkcs7, in + idx, length);
|
||||
idx += length;
|
||||
@@ -5244,6 +5249,11 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
|
||||
if (pkiMsg != in && pkcs7->stream->length > 0) {
|
||||
pkiMsg2Sz = pkcs7->stream->length;
|
||||
}
|
||||
else {
|
||||
/* if pkiMsg2 is pkiMsg and not using an internal stream
|
||||
* buffer then the size is limited by inSz */
|
||||
pkiMsg2Sz = inSz;
|
||||
}
|
||||
}
|
||||
|
||||
/* restore content */
|
||||
|
Reference in New Issue
Block a user