Fix off-by-one max payload checks

This commit is contained in:
Justin Starry
2020-09-15 15:25:00 +08:00
committed by Michael Vines
parent c231bb7154
commit f6cda2579f
4 changed files with 4 additions and 4 deletions

View File

@ -219,7 +219,7 @@ pub fn request_airdrop_transaction(
Error::new(ErrorKind::Other, "Airdrop failed")
})?;
let transaction_length = LittleEndian::read_u16(&buffer) as usize;
if transaction_length >= PACKET_DATA_SIZE || transaction_length == 0 {
if transaction_length > PACKET_DATA_SIZE || transaction_length == 0 {
return Err(Error::new(
ErrorKind::Other,
format!(