GCS_MAVLink: add integer bound check

This commit is contained in:
Noah Markert 2024-11-30 23:55:59 +01:00
parent 53ee7d6e75
commit 8561dfb882
No known key found for this signature in database
GPG Key ID: 99917DC4D1721135
1 changed files with 5 additions and 1 deletions

View File

@ -5151,7 +5151,11 @@ static int32_t convert_COMMAND_LONG_loc_param(float param, bool stores_location)
} }
if (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; return param;