From 94d58a823a62b239cf8d901ce2766ead6d38fabd Mon Sep 17 00:00:00 2001 From: Tethys Svensson Date: Sat, 25 Jan 2025 00:16:05 +0100 Subject: [PATCH] Fix an off-by-one in `impl GattValue for [u8; N]` --- host/src/types/gatt_traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/src/types/gatt_traits.rs b/host/src/types/gatt_traits.rs index 97edd272..40a746f7 100644 --- a/host/src/types/gatt_traits.rs +++ b/host/src/types/gatt_traits.rs @@ -130,7 +130,7 @@ impl GattValue for [u8; N] { const MAX_SIZE: usize = N; fn from_gatt(data: &[u8]) -> Result { - if data.len() < Self::MAX_SIZE { + if data.len() <= Self::MAX_SIZE { let mut actual = [0; N]; actual[..data.len()].copy_from_slice(data); Ok(actual)