Skip to content

Commit

Permalink
more strict checks in cbor parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
conorpp committed Feb 27, 2020
1 parent 4fb1666 commit 5738bcc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fido2/ctap_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,8 @@ uint8_t ctap_parse_extensions(CborValue * val, CTAP_extensions * ext)
if (ret == CborErrorOutOfMemory)
{
printf2(TAG_ERR,"Error, rp map key is too large. Ignoring.\n");
cbor_value_advance(&map);
cbor_value_advance(&map);
check_ret( cbor_value_advance(&map) );
check_ret( cbor_value_advance(&map) );
continue;
}
check_ret(ret);
Expand Down Expand Up @@ -1353,11 +1353,21 @@ uint8_t ctap_parse_client_pin(CTAP_clientPin * CP, uint8_t * request, int length
break;
case CP_getKeyAgreement:
printf1(TAG_CP,"CP_getKeyAgreement\n");
if (cbor_value_get_type(&map) != CborBooleanType)
{
printf2(TAG_ERR,"Error, expecting cbor boolean\n");
return CTAP2_ERR_INVALID_CBOR_TYPE;
}
ret = cbor_value_get_boolean(&map, &CP->getKeyAgreement);
check_ret(ret);
break;
case CP_getRetries:
printf1(TAG_CP,"CP_getRetries\n");
if (cbor_value_get_type(&map) != CborBooleanType)
{
printf2(TAG_ERR,"Error, expecting cbor boolean\n");
return CTAP2_ERR_INVALID_CBOR_TYPE;
}
ret = cbor_value_get_boolean(&map, &CP->getRetries);
check_ret(ret);
break;
Expand Down

0 comments on commit 5738bcc

Please sign in to comment.