Skip to content

Conversation

@benma
Copy link
Collaborator

@benma benma commented Dec 23, 2025

No description provided.

benma's agent added 3 commits December 23, 2025 22:36
The serial-link parser subtracts 5 bytes (type+len+crc) when
validating a frame.  If a truncated frame reaches
SERIAL_LINK_STATE_CHECK with frame_len < 5, the subtraction
underflows, allowing out-of-bounds reads during CRC/length handling.

Reject frames shorter than the minimum header+CRC size before parsing
the length.
The serial-link frame buffer is byte-addressed. Casting &frame[1] /
&frame[3+len] to a uint16_t* can be unaligned, which is undefined
behavior in C.

Decode the little-endian length and CRC fields bytewise instead of via
unaligned uint16_t loads.
The BLE HWW path previously relied on ASSERT(payload_length == 64),
which is compiled out in release builds.

Enforce the expected USB HID report size at runtime and drop malformed
frames so usb_packet_process() never consumes stale/partial payload
bytes. Also include the headers that define USB_REPORT_SIZE and
USB_FRAME explicitly.
@benma benma requested a review from NickeZ December 23, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant