Skip to content

Commit

Permalink
Merge pull request #254 from igiona/FixUnlignedGattAccessOnPrimitives
Browse files Browse the repository at this point in the history
fix(FixedGattValue): avoid misaligned data access for Primitive
  • Loading branch information
Dirbaio committed May 13, 2024
2 parents 3c53b8c + 7108dae commit d5f023b
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 d5f023b

Please sign in to comment.