From 7108daeb5a61ac36ccd486c0e6b7ac48c94cc35e Mon Sep 17 00:00:00 2001 From: Giona Imperatori Date: Mon, 13 May 2024 21:43:12 +0200 Subject: [PATCH] fix(FixedGattValue): avoid misaligned data access for Primitive --- nrf-softdevice/src/ble/gatt_traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nrf-softdevice/src/ble/gatt_traits.rs b/nrf-softdevice/src/ble/gatt_traits.rs index a72a4d3d..1b9ce86f 100644 --- a/nrf-softdevice/src/ble/gatt_traits.rs +++ b/nrf-softdevice/src/ble/gatt_traits.rs @@ -66,7 +66,7 @@ impl FixedGattValue for T { if data.len() != Self::SIZE { panic!("Bad len") } - unsafe { *(data.as_ptr() as *const Self) } + unsafe { (data.as_ptr() as *const Self).read_unaligned() } } fn to_gatt(&self) -> &[u8] {