GCS_MAVLink: assert max length of statustexts we send to the GCS

This commit is contained in:
Peter Barker 2019-07-23 15:09:59 +10:00 committed by Tom Pittenger
parent db9f7c3dd5
commit 0bbe049477

View File

@ -1741,6 +1741,12 @@ void GCS_MAVLINK::send_ahrs()
*/
void GCS::send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text)
{
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
if (strlen(text) > MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN) {
AP_HAL::panic("Statustext (%s) too long", text);
}
#endif
AP_Logger *logger = AP_Logger::get_singleton();
if (logger != nullptr) {
logger->Write_Message(text);