fix max length check

This commit is contained in:
Robin Appelman 2020-08-16 19:22:00 +02:00
commit 98458df33d

View file

@ -218,7 +218,7 @@ impl SensorReader {
} }
(3, length_low_byte) => { (3, length_low_byte) => {
self.length = length_low_byte; self.length = length_low_byte;
if self.length > MAX_RESPONSE_SIZE as u8 { if self.length > (MAX_RESPONSE_SIZE - 4) as u8 {
self.byte_offset = 0; self.byte_offset = 0;
} }
Err(nb::Error::WouldBlock) Err(nb::Error::WouldBlock)