Merge pull request #4499 from SparkiDev/dec_ku_len

KeyUsage dcoding: Ensure data length is 1 or 2
This commit is contained in:
David Garske
2021-10-25 15:11:18 -07:00
committed by GitHub

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);