Skip to content

Commit

Permalink
[ETP]: Fixed an issue where receiving some ETP sessions could cause a…
Browse files Browse the repository at this point in the history
… crash

Fixed a boundary check when receiving an ETP session when reconstructing
the message payload in the final frame of the session.
  • Loading branch information
ad3154 committed Oct 8, 2023
1 parent 7b2040c commit ca2c881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion isobus/src/can_extended_transport_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ namespace isobus
(StateMachineState::RxDataSession == tempSession->state) &&
(messageData[SEQUENCE_NUMBER_DATA_INDEX] == (tempSession->lastPacketNumber + 1)))
{
for (std::uint8_t i = SEQUENCE_NUMBER_DATA_INDEX; (i < PROTOCOL_BYTES_PER_FRAME) && ((PROTOCOL_BYTES_PER_FRAME * tempSession->lastPacketNumber) + i < tempSession->get_message_data_length()); i++)
for (std::uint8_t i = SEQUENCE_NUMBER_DATA_INDEX; (i < PROTOCOL_BYTES_PER_FRAME) && (((PROTOCOL_BYTES_PER_FRAME * tempSession->processedPacketsThisSession) + i) < tempSession->get_message_data_length()); i++)
{
std::uint32_t currentDataIndex = (PROTOCOL_BYTES_PER_FRAME * tempSession->processedPacketsThisSession) + i;
tempSession->sessionMessage.set_data(messageData[1 + SEQUENCE_NUMBER_DATA_INDEX + i], currentDataIndex);
Expand Down

0 comments on commit ca2c881

Please sign in to comment.