Fix buffer overflow in mavlink_receive.cpp

This commit is contained in:
zhangteng0526
2024-07-03 10:58:40 +08:00
committed by Beat Küng
parent f65653a391
commit e03e0261a1
+1 -1
View File
@@ -1818,7 +1818,7 @@ MavlinkReceiver::handle_message_serial_control(mavlink_message_t *msg)
if (shell) {
// we ignore the timeout, EXCLUSIVE & BLOCKING flags of the SERIAL_CONTROL message
if (serial_control_mavlink.count > 0) {
if (serial_control_mavlink.count > 0 && serial_control_mavlink.count <= sizeof(serial_control_mavlink.data)) {
shell->setTargetID(msg->sysid, msg->compid);
shell->write(serial_control_mavlink.data, serial_control_mavlink.count);
}