summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAnton Ivanov <[email protected]>2026-09-02 22:23:25 +0100
committerTom Rini <[email protected]>2026-09-04 12:22:06 -0600
commit01460dfbda162ca9a2fddbba001edacabc38dd2f (patch)
tree4f6d8aae96ecf772c0496935f132d26e4525f2bc /contrib
parent506ef1fd79c49d9c8326c9e73e89d35771cb650f (diff)
spl: fit: Harden external-data offset and size arithmetic
The data-offset, data-position and data-size FIT properties are excluded from the configuration signature, so they are attacker controlled even when signature verification succeeds. The offset and size arithmetic in load_simple_fit() can wrap on hostile values: - adding the external-data base offset to data-offset can wrap past UINT32_MAX, - get_aligned_image_size() adds the block-alignment overhead and rounds up to the block length, which can wrap past ULONG_MAX, - adding the FIT's device offset to the aligned external-data offset can wrap past ULONG_MAX. Make get_aligned_image_size() return the aligned size through an out parameter and fail with -EOVERFLOW when the computation would wrap, check the two offset additions explicitly, and compare the block-aligned size (the amount info->read() actually transfers) against max_size before reading. Do the same for the FIT header read in spl_simple_fit_read(). Signed-off-by: Anton Ivanov <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions