mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
protocol_splitter: delete non rtps or mavlink data from buffer
protocol_splitter: add missing buffer_size checker
This commit is contained in:
1 parent
a202bcbc73
commit
0cae3c129d
1 file changed
+2
-2
@@ -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