From 30f9fd9d2a1a070dbbe15049fe393ff5d66d92db Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 28 Aug 2020 14:09:59 +1000 Subject: [PATCH] GCS_MAVLink: fixed overrun of text passed to other libraries this caused corruption in log files, and was passing a non-nul-terminated string to notify and other libraries --- libraries/GCS_MAVLink/GCS_Common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 73eb329868..5aab2d82bc 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -1836,7 +1836,7 @@ void GCS::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list, u // send_text can be called from multiple threads; we must // protect the "text" member with _statustext_sem hal.util->vsnprintf(statustext_printf_buffer, sizeof(statustext_printf_buffer), fmt, arg_list); - memcpy(first_piece_of_text, statustext_printf_buffer, ARRAY_SIZE(first_piece_of_text)); + memcpy(first_piece_of_text, statustext_printf_buffer, ARRAY_SIZE(first_piece_of_text)-1); // filter destination ports to only allow active ports. statustext_t statustext{};