Skip to content

Slot-bounds checks ignore tlv_len: jump_app, slot_manager and recovery accept an image whose TLV area runs past the slot #150

Closed

Description

@srpatcha

stage1/jump_app.c, core/slot_manager.c and core/recovery.c each check hdr_size + image_size <= slot_size on their own, but none counts tlv_len. A header with image_size = slot_size - hdr_size and tlv_len = 1 passes the check, and TLV processing then reads past the end of the slot.

Reproduced on master: test_tlv_beyond_slot_rejected_before_payload_read (PR #109) fails at test_jump_app_bounds.c:205 with master's jump_app.c.

Fix: a single overflow-safe eos_image_fits_slot() that counts hdr + image + tlv, used by all three callers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions