Skip to content

Commit 5fc607c

Browse files
committed
bootutil_loader: Ensure that the load_addr is set
Ensure that the load_addr field contains a valid value by rejecting all images that do not include the IMAGE_F_ROM_FIXED or IMAGE_F_RAM_LOAD flags if the MCUBOOT_CHECK_HEADER_LOAD_ADDRESS check is enabled. Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
1 parent 0569add commit 5fc607c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

boot/bootutil/src/bootutil_loader.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ boot_check_header_valid(struct boot_loader_state *state, int slot)
132132
}
133133
#endif
134134

135+
#ifdef MCUBOOT_CHECK_HEADER_LOAD_ADDRESS
136+
if (hdr->ih_flags & (IMAGE_F_ROM_FIXED | IMAGE_F_RAM_LOAD) == 0) {
137+
return false;
138+
}
139+
#endif
140+
135141
return true;
136142
}
137143

0 commit comments

Comments
 (0)