Skip to content

Commit

Permalink
AP_EFI: check bounds of serial buffer in Hirth serial driver
Browse files Browse the repository at this point in the history
ensure we don't consume invalid data
  • Loading branch information
tridge committed Apr 5, 2024
1 parent 364e6f0 commit a969fba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AP_EFI/AP_EFI_Serial_Hirth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void AP_EFI_Serial_Hirth::check_response()
computed_checksum += res_data.quantity = port->read();
computed_checksum += res_data.code = port->read();

if (res_data.code == requested_code) {
if (res_data.code == requested_code && res_data.quantity > QUANTITY_REQUEST_STATUS) {
for (int i = 0; i < (res_data.quantity - QUANTITY_REQUEST_STATUS); i++) {
computed_checksum += raw_data[i] = port->read();
}
Expand Down

0 comments on commit a969fba

Please sign in to comment.