Browse Source

Copter: avoid integer underflow in mavlink txspace check

master
Andrew Tridgell 11 years ago
parent
commit
b36e4b4122
  1. 4
      ArduCopter/GCS_Mavlink.pde

4
ArduCopter/GCS_Mavlink.pde

@ -14,7 +14,7 @@ static bool gcs_out_of_time; @@ -14,7 +14,7 @@ static bool gcs_out_of_time;
// check if a message will fit in the payload space available
#define CHECK_PAYLOAD_SIZE(id) if (payload_space < MAVLINK_MSG_ID_ ## id ## _LEN) return false
#define CHECK_PAYLOAD_SIZE(id) if (txspace < MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN) return false
// prototype this for use inside the GCS class
static void gcs_send_text_fmt(const prog_char_t *fmt, ...);
@ -458,7 +458,7 @@ static bool telemetry_delayed(mavlink_channel_t chan) @@ -458,7 +458,7 @@ static bool telemetry_delayed(mavlink_channel_t chan)
// try to send a message, return false if it won't fit in the serial tx buffer
bool GCS_MAVLINK::try_send_message(enum ap_message id)
{
int16_t payload_space = comm_get_txspace(chan) - MAVLINK_NUM_NON_PAYLOAD_BYTES;
uint16_t txspace = comm_get_txspace(chan);
if (telemetry_delayed(chan)) {
return false;

Loading…
Cancel
Save