KeyUsage dcoding: Ensure data length is 1 or 2

This commit is contained in:
Sean Parkinson
2021-10-25 09:22:31 +10:00
parent bf2b13939f
commit 8e6c6e7757

View File

@@ -14986,6 +14986,9 @@ static int DecodeKeyUsage(const byte* input, int sz, DecodedCert* cert)
if (ret != 0)
return ret;
if (length == 0 || length > 2)
return ASN_PARSE_E;
cert->extKeyUsage = (word16)(input[idx]);
if (length == 2)
cert->extKeyUsage |= (word16)(input[idx+1] << 8);