Adds temporary fix for rcv frame panic issue (#1862)

This commit is contained in:
Alexandra Clifford 2024-07-29 03:36:39 -04:00 committed by GitHub
parent 237804efb6
commit 36ed7bdf14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added range check to avoid panic when indexing into RX_BUFFER slice
### Changed ### Changed
### Fixed ### Fixed

View File

@ -391,7 +391,12 @@ fn ZB_MAC() {
log::warn!("Receive queue full"); 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) { if will_auto_send_ack(frm) {
*STATE.borrow_ref_mut(cs) = Ieee802154State::TxAck; *STATE.borrow_ref_mut(cs) = Ieee802154State::TxAck;
} else if should_send_enhanced_ack(frm) { } else if should_send_enhanced_ack(frm) {