Skip to content

Commit 94360d5

Browse files
DOAR-Infineond3zd3z
authored andcommitted
Fix possible array index overflow in loader.c: fill_rsp()
Signed-off-by: INFINEON\DovhalA <[email protected]>
1 parent 472d4c7 commit 94360d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

boot/bootutil/src/loader.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ fill_rsp(struct boot_loader_state *state, struct boot_rsp *rsp)
182182
break;
183183
}
184184
}
185+
/* At least one image must be active, otherwise skip the execution */
186+
if (BOOT_CURR_IMG(state) >= BOOT_IMAGE_NUMBER) {
187+
return;
188+
}
185189
#endif
186190

187191
#if defined(MCUBOOT_DIRECT_XIP) || defined(MCUBOOT_RAM_LOAD)

0 commit comments

Comments
 (0)