Skip to content

Commit

Permalink
Merge pull request #15373 from Martyx00/master
Browse files Browse the repository at this point in the history
Check CAN DLC length value
  • Loading branch information
0xc0170 authored Jan 16, 2023
2 parents 81f40fc + b6de6bc commit b5c2124
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion targets/TARGET_STM/can_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b5c2124

Please sign in to comment.