Skip to content

Commit

Permalink
Fix an off-by-one in impl GattValue for [u8; N]
Browse files Browse the repository at this point in the history
  • Loading branch information
TethysSvensson authored and lulf committed Jan 25, 2025
1 parent a1daee2 commit 94d58a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion host/src/types/gatt_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<const N: usize> GattValue for [u8; N] {
const MAX_SIZE: usize = N;

fn from_gatt(data: &[u8]) -> Result<Self, FromGattError> {
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)
Expand Down

0 comments on commit 94d58a8

Please sign in to comment.