mirror of
https://github.com/intrepidcs/intrepid-socketcan-kernel-module.git
synced 2026-08-05 01:18:37 +02:00
Reject CAN frames with length > 8
Previously, they were just truncated. In any case, this is only hit if the userspace daemon gives us more than 8 bytes for CAN, which it shouldn't.
This commit is contained in:
+4
-1
@@ -471,7 +471,10 @@ static int intrepid_fill_can_frame_from_neomessage(
|
||||
if (msg->status.remoteFrame)
|
||||
cf->can_id |= CAN_RTR_FLAG;
|
||||
|
||||
cf->can_dlc = get_can_dlc(msg->length);
|
||||
if (unlikely(msg->length > 8))
|
||||
return -1;
|
||||
|
||||
cf->can_dlc = msg->length;
|
||||
memcpy(cf->data, data, cf->can_dlc);
|
||||
|
||||
stats->rx_bytes += cf->can_dlc;
|
||||
|
||||
Reference in New Issue
Block a user