GCS_MAVLink: account for snprintf now null-terminating strings

This commit is contained in:
Peter Barker 2018-09-06 12:18:47 +10:00 committed by Andrew Tridgell
parent 4c794ebba3
commit 96b5be0e7d
2 changed files with 4 additions and 4 deletions

View File

@ -7,8 +7,8 @@ extern const AP_HAL::HAL& hal;
*/
void GCS::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list)
{
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1] {};
hal.util->vsnprintf((char *)text, sizeof(text)-1, fmt, arg_list);
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
hal.util->vsnprintf(text, sizeof(text), fmt, arg_list);
send_statustext(severity, GCS_MAVLINK::active_channel_mask() | GCS_MAVLINK::streaming_channel_mask(), text);
}

View File

@ -628,8 +628,8 @@ void GCS_MAVLINK::handle_gimbal_report(AP_Mount &mount, mavlink_message_t *msg)
void GCS_MAVLINK::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list)
{
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1] {};
hal.util->vsnprintf((char *)text, sizeof(text)-1, fmt, arg_list);
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
hal.util->vsnprintf(text, sizeof(text), fmt, arg_list);
gcs().send_statustext(severity, (1<<chan), text);
}
void GCS_MAVLINK::send_text(MAV_SEVERITY severity, const char *fmt, ...)