5
0
mirror of https://github.com/ArduPilot/ardupilot synced 2025-03-08 14:43:57 -04:00

GCS_MAVLink: Fix excess trimming of autopilot version

This commit is contained in:
Michael du Breuil 2020-02-18 00:57:22 -07:00 committed by Peter Barker
parent ab07bae8a6
commit 296c014d14

View File

@ -2152,18 +2152,15 @@ void GCS_MAVLINK::send_autopilot_version() const
(uint32_t)(version.fw_type) << (8 * 0); (uint32_t)(version.fw_type) << (8 * 0);
if (version.fw_hash_str) { if (version.fw_hash_str) {
strncpy(flight_custom_version, version.fw_hash_str, sizeof(flight_custom_version) - 1); strncpy(flight_custom_version, version.fw_hash_str, ARRAY_SIZE(flight_custom_version));
flight_custom_version[sizeof(flight_custom_version) - 1] = '\0';
} }
if (version.middleware_hash_str) { if (version.middleware_hash_str) {
strncpy(middleware_custom_version, version.middleware_hash_str, sizeof(middleware_custom_version) - 1); strncpy(middleware_custom_version, version.middleware_hash_str, ARRAY_SIZE(middleware_custom_version));
middleware_custom_version[sizeof(middleware_custom_version) - 1] = '\0';
} }
if (version.os_hash_str) { if (version.os_hash_str) {
strncpy(os_custom_version, version.os_hash_str, sizeof(os_custom_version) - 1); strncpy(os_custom_version, version.os_hash_str, ARRAY_SIZE(os_custom_version));
os_custom_version[sizeof(os_custom_version) - 1] = '\0';
} }
mavlink_msg_autopilot_version_send( mavlink_msg_autopilot_version_send(