mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
add sanity check on PKCS7 index value
This commit is contained in:
@ -9733,6 +9733,10 @@ static int wc_PKCS7_DecryptKekri(PKCS7* pkcs7, byte* in, word32 inSz,
|
|||||||
*idx += (dateLen + 1);
|
*idx += (dateLen + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*idx > pkiMsgSz) {
|
||||||
|
return ASN_PARSE_E;
|
||||||
|
}
|
||||||
|
|
||||||
/* may have OPTIONAL OtherKeyAttribute */
|
/* may have OPTIONAL OtherKeyAttribute */
|
||||||
localIdx = *idx;
|
localIdx = *idx;
|
||||||
if ((*idx < kekIdSz) && GetASNTag(pkiMsg, &localIdx, &tag,
|
if ((*idx < kekIdSz) && GetASNTag(pkiMsg, &localIdx, &tag,
|
||||||
@ -9745,6 +9749,10 @@ static int wc_PKCS7_DecryptKekri(PKCS7* pkcs7, byte* in, word32 inSz,
|
|||||||
*idx += length;
|
*idx += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*idx > pkiMsgSz) {
|
||||||
|
return ASN_PARSE_E;
|
||||||
|
}
|
||||||
|
|
||||||
/* get KeyEncryptionAlgorithmIdentifier */
|
/* get KeyEncryptionAlgorithmIdentifier */
|
||||||
if (GetAlgoId(pkiMsg, idx, &keyWrapOID, oidKeyWrapType, pkiMsgSz) < 0)
|
if (GetAlgoId(pkiMsg, idx, &keyWrapOID, oidKeyWrapType, pkiMsgSz) < 0)
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
|
Reference in New Issue
Block a user