Mission: fix bounds checking of MISSION_ITEM lat/lon

This commit is contained in:
Michael du Breuil 2016-06-06 02:55:22 -06:00 committed by Tom Pittenger
parent 41bb237799
commit fb07b8c4cc

View File

@ -859,8 +859,16 @@ MAV_MISSION_RESULT AP_Mission::mavlink_to_mission_cmd(const mavlink_mission_item
default:
// all other commands use x and y as lat/lon. We need to
// multiply by 1e7 to convert to int32_t
if (fabsf(packet.x) < 90.0f) {
mav_cmd.x = packet.x * 1.0e7f;
} else {
return MAV_MISSION_INVALID_PARAM5_X;
}
if (fabsf(packet.y) < 180.0f) {
mav_cmd.y = packet.y * 1.0e7f;
} else {
return MAV_MISSION_INVALID_PARAM6_Y;
}
break;
}