From 31328fe7e7d78baed7b0f666658cc12e8d9d1111 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Sat, 18 May 2019 14:34:54 -0400 Subject: [PATCH] dont fail when public key type is too large --- fido2/ctap_parse.c | 10 +++++++++- tools/testing/tests/fido2.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fido2/ctap_parse.c b/fido2/ctap_parse.c index ffa1301..0825bba 100644 --- a/fido2/ctap_parse.c +++ b/fido2/ctap_parse.c @@ -929,7 +929,15 @@ uint8_t parse_credential_descriptor(CborValue * arr, CTAP_credentialDescriptor * buflen = sizeof(type); ret = cbor_value_copy_text_string(&val, type, &buflen, NULL); - check_ret(ret); + if (ret == CborErrorOutOfMemory) + { + cred->type = PUB_KEY_CRED_UNKNOWN; + } + else + { + check_ret(ret); + } + if (strncmp(type, "public-key",11) == 0) { diff --git a/tools/testing/tests/fido2.py b/tools/testing/tests/fido2.py index 70f0e84..8aa36a2 100644 --- a/tools/testing/tests/fido2.py +++ b/tools/testing/tests/fido2.py @@ -621,6 +621,16 @@ class FIDO2Tests(Tester): other={"exclude_list": [{"id": b"1234", "type": "rot13"}]}, ) + self.testMC( + "Send MC request with excludeList item with bogus type, expect SUCCESS", + cdh, + rp, + user, + key_params, + expectedError=CtapError.ERR.SUCCESS, + other={"exclude_list": [{"id": b"1234", "type": "mangoPapayaCoconutNotAPublicKey"}]}, + ) + self.testMC( "Send MC request with excludeList with bad item, expect error", cdh,