mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
fix(core/bootloader): fix repeated firmware upload
[no changelog]
This commit is contained in:
parent
b8c27d5fd6
commit
ee6410acdd
@ -577,10 +577,11 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
|
||||
memcpy(&hdr, received_hdr, sizeof(hdr));
|
||||
|
||||
size_t headers_end = IMAGE_HEADER_SIZE + vhdr.hdrlen;
|
||||
headers_offset = IMAGE_CODE_ALIGN(IMAGE_HEADER_SIZE + vhdr.hdrlen);
|
||||
size_t tmp_headers_offset =
|
||||
IMAGE_CODE_ALIGN(IMAGE_HEADER_SIZE + vhdr.hdrlen);
|
||||
|
||||
// check padding between headers and the code
|
||||
for (size_t i = headers_end; i < headers_offset; i++) {
|
||||
for (size_t i = headers_end; i < tmp_headers_offset; i++) {
|
||||
if (CHUNK_BUFFER_PTR[i] != 0) {
|
||||
MSG_SEND_INIT(Failure);
|
||||
MSG_SEND_ASSIGN_VALUE(code, FailureType_Failure_ProcessError);
|
||||
@ -705,6 +706,7 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
|
||||
NULL);
|
||||
}
|
||||
|
||||
headers_offset = IMAGE_CODE_ALIGN(IMAGE_HEADER_SIZE + vhdr.hdrlen);
|
||||
read_offset = IMAGE_INIT_CHUNK_SIZE;
|
||||
|
||||
// request the rest of the first chunk
|
||||
|
Loading…
Reference in New Issue
Block a user