mavlink_ftp: fix to correctly trim reply messages

Clear any not used payload data to correctly trim mavlink ftp message reply to avoid sending long ACK and NACK messages.
This commit is contained in:
Oleg 2022-08-11 12:40:44 +03:00 committed by Beat Küng
parent cd971948da
commit 6ea3c6a7d2
1 changed files with 3 additions and 0 deletions

View File

@ -331,6 +331,9 @@ MavlinkFTP::_reply(mavlink_file_transfer_protocol_t *ftp_req)
memcpy(_last_reply, ftp_req, sizeof(_last_reply));
}
// clear any not used payload data to correctly trim mavlink ftp message reply
memset(&payload->data[payload->size], 0, kMaxDataLength - payload->size);
PX4_DEBUG("FTP: %s seq_number: %" PRIu16, payload->opcode == kRspAck ? "Ack" : "Nak", payload->seq_number);
#ifdef MAVLINK_FTP_UNIT_TEST