mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
fix septentrio: ensure the crc check does not read past the buffer size
in case the input data is invalid.
This commit is contained in:
committed by
Alexander Lerach
parent
d13692ca46
commit
ac74a02d7c
@@ -243,7 +243,7 @@ bool Decoder::done() const
|
||||
|
||||
bool Decoder::can_parse() const
|
||||
{
|
||||
return done()
|
||||
return done() && _message.header.length <= sizeof(_message)
|
||||
&& _message.header.crc == buffer_crc16(reinterpret_cast<const uint8_t *>(&_message) + 4, _message.header.length - 4);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user