Skip to content

Fix image len bound check in update_ram.c#706

Merged
dgarske merged 2 commits intowolfSSL:masterfrom
danielinux:update-ram-bounds
Mar 2, 2026
Merged

Fix image len bound check in update_ram.c#706
dgarske merged 2 commits intowolfSSL:masterfrom
danielinux:update-ram-bounds

Conversation

@danielinux
Copy link
Member

Fixes Fenrir/228

Copilot AI review requested due to automatic review settings March 2, 2026 12:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a missing bounds check to RAM-boot image loading to reject oversized images and extends the unit test suite to cover invalid headers, oversize rejection, and a successful RAM-boot path. This aligns wolfBoot_ramboot() behavior with existing fixed-partition size constraints used elsewhere in the image handling code.

Changes:

  • Add a partition-size-based upper bound check for the image payload length in wolfBoot_ramboot().
  • Add unit tests for RAM-boot: invalid magic, oversized length rejection, and success case.
  • Register the new tests in the unit test suite runner.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/update_ram.c Rejects images whose header-advertised payload size exceeds WOLFBOOT_PARTITION_SIZE - IMAGE_HEADER_SIZE before reading into RAM.
tools/unit-tests/unit-update-ram.c Adds and registers coverage for RAM-boot failure/success paths (invalid header, oversize, success).

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

@dgarske dgarske merged commit 63bad13 into wolfSSL:master Mar 2, 2026
311 checks passed
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.

3 participants