Skip to content

Commit a4dc9c3

Browse files
committed
Use partition size as bound if header sector is erased
1 parent b180574 commit a4dc9c3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/update_flash.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
441441
uint16_t base_hash_sz;
442442
uint8_t *base_hash;
443443

444+
if (boot->fw_size == 0) {
445+
/* Resume after powerfail can leave boot header erased; bound by partition size. */
446+
boot->fw_size = WOLFBOOT_PARTITION_SIZE - IMAGE_HEADER_SIZE;
447+
}
448+
444449
/* Use biggest size for the swap */
445450
total_size = boot->fw_size + IMAGE_HEADER_SIZE;
446451
if ((update->fw_size + IMAGE_HEADER_SIZE) > total_size)

0 commit comments

Comments
 (0)