Skip to content

Commit

Permalink
FollowMe: avoid integer underflow in mavlink txspace check
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tridgell committed Jul 27, 2014
1 parent b36e4b4 commit b82457e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FollowMe/simplegcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ void simplegcs_send_heartbeat(mavlink_channel_t chan) {

bool simplegcs_try_send_statustext(mavlink_channel_t chan, const char *text, int len) {

int payload_space = comm_get_txspace(chan) - MAVLINK_NUM_NON_PAYLOAD_BYTES;
if (payload_space < MAVLINK_MSG_ID_STATUSTEXT_LEN) return false;
uint16_t txspace = comm_get_txspace(chan);
if (payload_space < MAVLINK_MSG_ID_STATUSTEXT_LEN+MAVLINK_NUM_NON_PAYLOAD_BYTES) return false;

char statustext[50] = { 0 };
if (len < 50) {
Expand Down

0 comments on commit b82457e

Please sign in to comment.