AP_HAL_ChibiOS: use datalength when copying payload into CAN Frames

This commit is contained in:
bugobliterator 2022-02-19 21:58:52 +05:30 committed by Andrew Tridgell
parent cf5d94b81f
commit 4bdbd37731
1 changed files with 1 additions and 1 deletions

View File

@ -887,7 +887,7 @@ bool CANIface::readRxFIFO(uint8_t fifo_index)
frame.dlc = (frame_ptr[1] & DLC_MASK) >> 16;
uint8_t *data = (uint8_t*)&frame_ptr[2];
for (uint8_t i = 0; i < AP_HAL::CANFrame::MaxDataLen; i++) {
for (uint8_t i = 0; i < AP_HAL::CANFrame::dlcToDataLength(frame.dlc); i++) {
frame.data[i] = data[i];
}