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
This commit is contained in:
Andrew Tridgell 2020-08-28 14:09:59 +10:00 committed by Peter Barker
parent b18928e28e
commit 30f9fd9d2a

View File

@ -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{};