Skip to content

Commit

Permalink
fix(models): disable crc check while fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Sep 20, 2024
1 parent 3e7dcf6 commit a512632
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/models/message/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,12 @@ impl StdAddr {
return Err(ParseAddrError::BadFormat);
};

let crc = crc_16(&buffer[..34]);
if buffer[34] as u16 != (crc >> 8) || buffer[35] as u16 != (crc & 0xff) {
return Err(ParseAddrError::BadFormat);
#[cfg(not(fuzzing))]
{
let crc = crc_16(&buffer[..34]);
if buffer[34] as u16 != (crc >> 8) || buffer[35] as u16 != (crc & 0xff) {
return Err(ParseAddrError::BadFormat);
}
}

let addr = StdAddr::new(
Expand Down

0 comments on commit a512632

Please sign in to comment.