forked from wolfSSL/wolfssl
Merge pull request #4499 from SparkiDev/dec_ku_len
KeyUsage dcoding: Ensure data length is 1 or 2
This commit is contained in:
@@ -14986,6 +14986,9 @@ static int DecodeKeyUsage(const byte* input, int sz, DecodedCert* cert)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (length == 0 || length > 2)
|
||||||
|
return ASN_PARSE_E;
|
||||||
|
|
||||||
cert->extKeyUsage = (word16)(input[idx]);
|
cert->extKeyUsage = (word16)(input[idx]);
|
||||||
if (length == 2)
|
if (length == 2)
|
||||||
cert->extKeyUsage |= (word16)(input[idx+1] << 8);
|
cert->extKeyUsage |= (word16)(input[idx+1] << 8);
|
||||||
|
Reference in New Issue
Block a user