Skip to content

Commit 6a5ee45

Browse files
committed
minor fix in case of empty external partition
1 parent 1970fbd commit 6a5ee45

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ int wolfBoot_open_image(struct wolfBoot_image *img, uint8_t part)
211211
if (!img)
212212
return -1;
213213
memset(img, 0, sizeof(struct wolfBoot_image));
214+
img->part = part;
214215
if (part == PART_SWAP) {
215216
img->part = PART_SWAP;
216217
img->hdr = (void *)WOLFBOOT_PARTITION_SWAP_ADDRESS;
@@ -237,7 +238,6 @@ int wolfBoot_open_image(struct wolfBoot_image *img, uint8_t part)
237238

238239
if (*size >= WOLFBOOT_PARTITION_SIZE)
239240
return -1;
240-
img->part = part;
241241
img->hdr_ok = 1;
242242
img->fw_size = *size;
243243
img->fw_base = img->hdr + IMAGE_HEADER_SIZE;

src/loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int wolfBoot_update(int fallback_allowed)
8989
if ((update.fw_size + IMAGE_HEADER_SIZE) > total_size)
9090
total_size = update.fw_size + IMAGE_HEADER_SIZE;
9191

92-
if (total_size < IMAGE_HEADER_SIZE)
92+
if (total_size <= IMAGE_HEADER_SIZE)
9393
return -1;
9494

9595
/* Check the first sector to detect interrupted update */

0 commit comments

Comments
 (0)