Browse Source

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
c415-sdk
Andrew Tridgell 5 years ago committed by Peter Barker
parent
commit
30f9fd9d2a
  1. 2
      libraries/GCS_MAVLink/GCS_Common.cpp

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

Loading…
Cancel
Save