Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fdt: break loop compatibles when no NUL-terminator is found#807

Open
rizlik wants to merge 1 commit into
wolfSSL:master from
rizlik:fdt-fix
Open

fdt: break loop compatibles when no NUL-terminator is found #807
rizlik wants to merge 1 commit into
wolfSSL:master from
rizlik:fdt-fix

Conversation

@rizlik

@rizlik rizlik commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the flattened device tree (FDT) compatible string-list parsing to avoid a potential hang when a compatible property is malformed (no NUL terminator within the declared property length), and adds a regression test to ensure the parser terminates.

Changes:

  • Update fdt_node_offset_by_compatible() to stop scanning the compatible property when no in-bounds NUL terminator is found.
  • Add a unit test with a minimal malformed FDT blob (unterminated compatible) and run it in a dedicated TCase with a timeout to catch regressions as failures.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tools/unit-tests/unit-fdt.c Adds a malformed-FDT regression test and a dedicated timeout test case to prevent suite hangs.
src/fdt.c Breaks out of the compatible property scan when memchr() can’t find an in-bounds NUL terminator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fdt.c
Comment on lines 738 to +742
prop = nextprop + 1;
}
else {
/* No NUL terminator within the declared length, break. */
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments
@dgarske dgarske Awaiting requested review from dgarske

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /