GCS_MAVLink: Added sanity check for DO_JUMP command on mission load.

This commit is contained in:
Niti Rohilla 2016-06-14 13:04:17 +05:30 committed by Tom Pittenger
parent e13d5fa0bf
commit cadd95fdd8

View File

@ -824,6 +824,14 @@ bool GCS_MAVLINK::handle_mission_item(mavlink_message_t *msg, AP_Mission &missio
result = MAV_MISSION_INVALID_SEQUENCE;
goto mission_ack;
}
// sanity check for DO_JUMP command
if (cmd.id == MAV_CMD_DO_JUMP) {
if ((cmd.content.jump.target >= mission.num_commands() && cmd.content.jump.target >= waypoint_request_last) || cmd.content.jump.target == 0) {
result = MAV_MISSION_ERROR;
goto mission_ack;
}
}
// if command index is within the existing list, replace the command
if (seq < mission.num_commands()) {