Skip to content

Commit ef3fe77

Browse files
committed
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 Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com> Change-Id: I8d64cf6319a632e39ff51af1296faf92d3118278
1 parent 671513c commit ef3fe77

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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)