mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 12:50:37 +00:00
Fix offset calculation
This commit is contained in:
parent
d1429868ce
commit
9ac8944478
@ -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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user