Skip to content

lib: bound parse_canframe input length - #633

Closed
seldatrgt35 wants to merge 1 commit into
linux-can:masterfrom
seldatrgt35:fix/parse-canframe-input-bound
Closed

seldatrgt35 wants to merge 1 commit into
linux-can:masterfrom
seldatrgt35:fix/parse-canframe-input-bound

Conversation

@seldatrgt35

Copy link
Copy Markdown

Summary

Pass the available input buffer size to parse_canframe() and reject
input that has no null terminator within that bound.

Update all four callers to provide the available buffer size. This
prevents the unbounded strlen() read reported in #632 while preserving
the existing parsing behavior for valid CAN CC, CAN FD, CAN XL, and RTR
frame strings.

Validation

  • Built cansend, canplayer, log2asc, and log2long
  • Built the complete project with Make
  • Verified the issue PoC under AddressSanitizer
  • Confirmed unterminated input is rejected without an ASan error
  • Smoke-tested valid CAN CC, CAN FD, CAN XL, and RTR inputs
  • git diff --check passed

CMake configuration was not completed in the local WSL environment
because pkg-config is unavailable; the Make builds passed.

Fixes #632

Pass the available input buffer size to parse_canframe() and reject
buffers without a null terminator inside that bound.

This prevents the parser from reading beyond unterminated input buffers.

Fixes: linux-can#632
Signed-off-by: Selda Nur Turgut <seldanur.turgut@ogr.deu.edu.tr>
@hartkopp

hartkopp commented Sep 3, 2026

Copy link
Copy Markdown
Member

Nothing to fix here.
#632

@hartkopp hartkopp closed this Sep 3, 2026
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.

lib: parse_canframe: strlen OOB read when input is not null-terminated

2 participants