Skip to content

Commit

Permalink
fix(FixedGattValue): avoid misaligned data access for Primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
igiona committed May 13, 2024
1 parent 3c53b8c commit 7108dae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nrf-softdevice/src/ble/gatt_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<T: Primitive> 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] {
Expand Down

0 comments on commit 7108dae

Please sign in to comment.