From 978f8e1a2fa500d8436ead6845baac1b6be3c68f Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 25 Nov 2024 16:59:39 +0100 Subject: [PATCH] fix(shared): Don't accept inconsistent encoding lengths in IdCred KIDs --- shared/src/cred.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/cred.rs b/shared/src/cred.rs index db70d6f0..2d98c3d8 100644 --- a/shared/src/cred.rs +++ b/shared/src/cred.rs @@ -83,7 +83,7 @@ impl IdCred { .map_err(|_| EDHOCError::CredentialTooLongError)? // TODO: how to avoid map_err overuse? } // kid that has been encoded as CBOR byte string - &[0x41, x, ..] if !Self::bstr_representable_as_int(x) => { + &[0x41, x] if !Self::bstr_representable_as_int(x) => { let mut bytes = BufferIdCred::new_from_slice(&[0xa1, KID_LABEL]) .map_err(|_| EDHOCError::CredentialTooLongError)?; bytes