Skip to content

Commit

Permalink
ensure payload_len is zeroed on start of a new multi-frame packet
Browse files Browse the repository at this point in the history
this ensures that we don't use payload bytes from rejected frames
  • Loading branch information
tridge authored and bugobliterator committed Feb 10, 2024
1 parent 916a1f3 commit e03112f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions canard.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ int16_t canardHandleRxFrame(CanardInstance* ins, const CanardCANFrame* frame, ui

// take off the crc and store the payload
rx_state->timestamp_usec = timestamp_usec;
rx_state->payload_len = 0;
const int16_t ret = bufferBlockPushBytes(&ins->allocator, rx_state, frame->data + 2,
(uint8_t) (frame->data_len - 3));
if (ret < 0)
Expand Down

0 comments on commit e03112f

Please sign in to comment.