From dcdf605a5e530d2f08ce25c8b9499c3a0552063c Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 2 Mar 2023 22:06:50 +0100 Subject: [PATCH] Fix crash when missing PubKey type. Signed-off-by: Pol Henarejos --- src/fido/cbor_make_credential.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fido/cbor_make_credential.c b/src/fido/cbor_make_credential.c index c798e13..e260f55 100644 --- a/src/fido/cbor_make_credential.c +++ b/src/fido/cbor_make_credential.c @@ -157,6 +157,8 @@ int cbor_make_credential(const uint8_t *data, size_t len) { CBOR_ERROR(CTAP2_ERR_MISSING_PARAMETER); for (int i = 0; i < pubKeyCredParams_len; i++) { + if (pubKeyCredParams[i].type.present == false) + CBOR_ERROR(CTAP2_ERR_MISSING_PARAMETER); if (strcmp(pubKeyCredParams[i].type.data, "public-key") != 0) continue; if (pubKeyCredParams[i].alg == FIDO2_ALG_ES256)