Correct error in processing of second component

Root nodes 0 and 1 may have up to 40 children (0 - 39), not 39 children
(0 - 38) as previously thought.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2023-02-20 17:28:36 +00:00
parent 18ec9d7da1
commit 03329970de

View file

@ -974,8 +974,8 @@ int mbedtls_oid_from_numeric_string(mbedtls_asn1_buf *oid,
if (component2 < 0) { if (component2 < 0) {
return component2; return component2;
} }
if ((component1 < 2) && (component2 > 38)) { if ((component1 < 2) && (component2 > 39)) {
/* Root nodes 0 and 1 may have up to 39 children */ /* Root nodes 0 and 1 may have up to 40 children, numbered 0-39 */
return MBEDTLS_ERR_ASN1_INVALID_DATA; return MBEDTLS_ERR_ASN1_INVALID_DATA;
} }
if (str_ptr < str_bound && *str_ptr != '\0') { if (str_ptr < str_bound && *str_ptr != '\0') {