Skip to content

Commit

Permalink
GCS_MAVLink: add integer bound check
Browse files Browse the repository at this point in the history
  • Loading branch information
RamReso committed Dec 3, 2024
1 parent 53ee7d6 commit 8561dfb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5151,7 +5151,11 @@ static int32_t convert_COMMAND_LONG_loc_param(float param, bool stores_location)
}

if (stores_location) {
return param *1e7;
float convertedValue = param *1e7;
if (convertedValue < INT32_MIN || convertedValue > INT32_MAX) {
return 0;
}
return convertedValue;
}

return param;
Expand Down

0 comments on commit 8561dfb

Please sign in to comment.