mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 19:52:20 +08:00
protocol_splitter: delete non rtps or mavlink data from buffer
protocol_splitter: add missing buffer_size checker
This commit is contained in:
@@ -568,8 +568,8 @@ void DevCommon::cleanup()
|
||||
|
||||
size_t garbage_end = 0;
|
||||
|
||||
if (!mavlink_available && !rtps_available) {
|
||||
garbage_end = math::max(_read_buffer->start_mavlink, _read_buffer->start_rtps);
|
||||
if (!mavlink_available && !rtps_available && (_read_buffer->buf_size > 0)) {
|
||||
garbage_end = _read_buffer->buf_size - 1;
|
||||
|
||||
} else {
|
||||
garbage_end = math::min(_read_buffer->start_mavlink, _read_buffer->start_rtps);
|
||||
|
||||
Reference in New Issue
Block a user