Skip to content
Commit 66d41e73 authored by Thomas Altenbach's avatar Thomas Altenbach Committed by Jamie
Browse files

boot: bootutil: Fix scratch trailer overwritten if image trailer is large



When using swap-scratch and the image trailer doesn't fit in a single
sector, some padding might be necessary between the end of the firmware
data and the beginning of the image trailer. Indeed, when the trailer
fit in a single sector, it is guaranteed that when copying the firmware
data from this sector to the scratch area, it won't overwrite the
trailer in the scratch trailer since that trailer is always smaller the
image trailer.

However, when the trailer is larger than a single sector, the sector
containing the last part of the firmware data might only contain a very
small part of the trailer. There is no more guarantee that the scratch
trailer won't get overwritten when copying that sector to the sratch
area. Therefore, a check must be added to handle that case.

Signed-off-by: default avatarThomas Altenbach <thomas.altenbach@legrand.com>
parent 8975d5c4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment