AP_InertialSensor: avoid integer underflow in mavlink txspace check

This commit is contained in:
Andrew Tridgell 2014-07-27 21:15:14 +10:00
parent 1aeac23f46
commit f7b01a6f3f

View File

@ -39,7 +39,7 @@ void AP_InertialSensor_UserInteract_MAVLink::_printf_P(const prog_char* fmt, ...
// STATUSTEXT messages should not add linefeed
msg[strlen(msg)-1] = 0;
}
while (comm_get_txspace(_chan) - MAVLINK_NUM_NON_PAYLOAD_BYTES < (int)sizeof(mavlink_statustext_t)) {
while (comm_get_txspace(_chan) < MAVLINK_NUM_NON_PAYLOAD_BYTES + (int)sizeof(mavlink_statustext_t)) {
hal.scheduler->delay(1);
}
mavlink_msg_statustext_send(_chan, SEVERITY_USER_RESPONSE, msg);