Check CAN DLC length value

pull/15373/head
Martyx00 2023-01-16 11:47:46 +01:00 committed by GitHub
parent 81f40fc9f4
commit b6de6bce7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1024,7 +1024,7 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
msg->type = (CANType)(((uint8_t)0x02 & can->sFIFOMailBox[rxfifo_default].RIR) >> 1);
/* Get the DLC */
msg->len = (uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR;
msg->len = ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR < 8) ? ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR) : ((uint8_t) 8);
/* Get the FMI */
// msg->FMI = (uint8_t)0xFF & (can->sFIFOMailBox[rxfifo_default].RDTR >> 8);
/* Get the data field */