From 9f4a11e7a77128d632b9a6c90687891fadf30da5 Mon Sep 17 00:00:00 2001 From: Oleksiy Protas Date: Tue, 16 Jul 2024 18:47:05 +0300 Subject: [PATCH] AP_Camera: proper string formatting Incoming strings are 32 bytes and may not be null-terminated if the full width is used --- libraries/AP_Camera/AP_Camera_MAVLinkCamV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Camera/AP_Camera_MAVLinkCamV2.cpp b/libraries/AP_Camera/AP_Camera_MAVLinkCamV2.cpp index 7a1caa214f..25027cf3b8 100644 --- a/libraries/AP_Camera/AP_Camera_MAVLinkCamV2.cpp +++ b/libraries/AP_Camera/AP_Camera_MAVLinkCamV2.cpp @@ -141,7 +141,7 @@ void AP_Camera_MAVLinkCamV2::handle_message(mavlink_channel_t chan, const mavlin const uint8_t fw_ver_build = (_cam_info.firmware_version & 0xFF000000) >> 24; // display camera info to user - gcs().send_text(MAV_SEVERITY_INFO, "Camera: %s.32 %s.32 fw:%u.%u.%u.%u", + gcs().send_text(MAV_SEVERITY_INFO, "Camera: %.32s %.32s fw:%u.%u.%u.%u", _cam_info.vendor_name, _cam_info.model_name, (unsigned)fw_ver_major,