From 13e360df08b3780e59352b23a29fab89b587537c Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Thu, 27 Aug 2015 14:22:05 +0900 Subject: [PATCH] Mission: sanity check location --- libraries/AP_Mission/AP_Mission.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/AP_Mission/AP_Mission.cpp b/libraries/AP_Mission/AP_Mission.cpp index e50eb809b5..02ceaa0797 100644 --- a/libraries/AP_Mission/AP_Mission.cpp +++ b/libraries/AP_Mission/AP_Mission.cpp @@ -705,6 +705,14 @@ bool AP_Mission::mavlink_to_mission_cmd(const mavlink_mission_item_t& packet, AP // copy location from mavlink to command if (copy_location || copy_alt) { + + // sanity check location + if (copy_location) { + if (fabsf(packet.x) > 90.0f || fabsf(packet.y) > 180.0f) { + return false; + } + } + switch (packet.frame) { case MAV_FRAME_MISSION: