AP_Mission: prevent use of uninitialised stack data

Well, probably not initialised, but certainly holding values we don't want
This commit is contained in:
Peter Barker 2022-09-21 15:42:50 +10:00 committed by Peter Barker
parent 4cfd1ee426
commit a785ac84a3
1 changed files with 3 additions and 5 deletions

View File

@ -1396,16 +1396,14 @@ MAV_MISSION_RESULT AP_Mission::mavlink_cmd_long_to_mission_cmd(const mavlink_com
// return true on success, false on failure
bool AP_Mission::mission_cmd_to_mavlink_int(const AP_Mission::Mission_Command& cmd, mavlink_mission_item_int_t& packet)
{
// zero result:
packet = {};
// command's position in mission list and mavlink id
packet.seq = cmd.index;
packet.command = cmd.id;
// set defaults
packet.current = 0; // 1 if we are passing back the mission command that is currently being executed
packet.param1 = 0;
packet.param2 = 0;
packet.param3 = 0;
packet.param4 = 0;
packet.autocontinue = 1;
// command specific conversions from mission command to mavlink packet