mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-12 05:17:09 +00:00
fix(core/bootloader): correctly handle images smaller than one chunk
This commit is contained in:
parent
056ac9d70a
commit
dd4d020a76
1
core/embed/bootloader/.changelog.d/2941.fixed
Normal file
1
core/embed/bootloader/.changelog.d/2941.fixed
Normal file
@ -0,0 +1 @@
|
||||
Fix installation of images smaller than 128kB.
|
@ -597,7 +597,10 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
|
||||
|
||||
// request the rest of the first chunk
|
||||
MSG_SEND_INIT(FirmwareRequest);
|
||||
chunk_requested = IMAGE_CHUNK_SIZE - read_offset;
|
||||
uint32_t chunk_limit = (firmware_remaining > IMAGE_CHUNK_SIZE)
|
||||
? IMAGE_CHUNK_SIZE
|
||||
: firmware_remaining;
|
||||
chunk_requested = chunk_limit - read_offset;
|
||||
MSG_SEND_ASSIGN_REQUIRED_VALUE(offset, read_offset);
|
||||
MSG_SEND_ASSIGN_REQUIRED_VALUE(length, chunk_requested);
|
||||
MSG_SEND(FirmwareRequest);
|
||||
|
Loading…
Reference in New Issue
Block a user