Skip to content

Commit 3f458fe

Browse files
adeaarmdavidvincze
authored andcommitted
Bootutil: always initialise the size returned by boot_util_image_size()
Assert on the pointer validity in debug builds and make sure that an initialised value of 0 is always returned even in case of errors Change-Id: Ia0546941296fc9741c1b20955d7c7a0d47c7b2e1 Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com>
1 parent 671513c commit 3f458fe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

boot/bootutil/src/swap_offset.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,9 @@ int boot_read_image_size(struct boot_loader_state *state, int slot, uint32_t *si
752752

753753
fap = BOOT_IMG_AREA(state, slot);
754754
assert(fap != NULL);
755+
assert(size != NULL);
756+
757+
*size = 0;
755758

756759
off = BOOT_TLV_OFF(boot_img_hdr(state, slot));
757760

0 commit comments

Comments
 (0)