Skip to content

Commit

Permalink
Adds temporary fix for rcv frame panic issue (#1862)
Browse files Browse the repository at this point in the history
  • Loading branch information
nand-nor authored Jul 29, 2024
1 parent 237804e commit 36ed7bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions esp-ieee802154/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added range check to avoid panic when indexing into RX_BUFFER slice

### Changed

### Fixed
Expand Down
7 changes: 6 additions & 1 deletion esp-ieee802154/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,12 @@ fn ZB_MAC() {
log::warn!("Receive queue full");
}

let frm = &RX_BUFFER[1..][..RX_BUFFER[0] as usize];
let frm = if RX_BUFFER[0] > FRAME_SIZE as u8 {
log::warn!("RX_BUFFER[0] {:} is larger than frame size", RX_BUFFER[0]);
&RX_BUFFER[1..][..FRAME_SIZE]
} else {
&RX_BUFFER[1..][..RX_BUFFER[0] as usize]
};
if will_auto_send_ack(frm) {
*STATE.borrow_ref_mut(cs) = Ieee802154State::TxAck;
} else if should_send_enhanced_ack(frm) {
Expand Down

0 comments on commit 36ed7bd

Please sign in to comment.