Skip to content

Commit

Permalink
Merge pull request #3750 from wackazong/patch-2
Browse files Browse the repository at this point in the history
Fix offset calculation
  • Loading branch information
Dirbaio authored Jan 10, 2025
2 parents d3ab956 + fe17ee8 commit 8f18e07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/nrf52840/src/bin/nfct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) {
}
(0, 0xb0, p1, p2) => {
info!("read");
let offs = u16::from_be_bytes([p1 & 0xef, p2]) as usize;
let offs = u16::from_be_bytes([p1 & 0x7f, p2]) as usize;
let len = if apdu.le == 0 { usize::MAX } else { apdu.le as usize };
let n = len.min(selected.len() - offs);
buf[..n].copy_from_slice(&selected[offs..][..n]);
Expand Down

0 comments on commit 8f18e07

Please sign in to comment.