fix for sanity check on PKCS7 indef read

This commit is contained in:
Jacob Barthelmeh
2022-04-22 15:28:03 -06:00
parent bf16696d8c
commit d96bd30398

View File

@@ -4590,8 +4590,13 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
ret = ASN_PARSE_E;
}
/* if indef, skip EOF */
if (isIndef && pkiMsg[idx] == ASN_EOC && pkiMsg[idx+1] == 0) {
idx += 2; /* skip EOF + zero byte */
if (isIndef) {
if (idx + 1 >= pkiMsgSz) {
ret = ASN_PARSE_E;
}
else if (pkiMsg[idx] == ASN_EOC && pkiMsg[idx+1] == 0) {
idx += 2; /* skip EOF + zero byte */
}
}
}