Skip to content

Commit 6d9ff5c

Browse files
committed
Adjusted bound check in unit test
1 parent bdaa5ad commit 6d9ff5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/unit-tests/unit-mock-flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,15 @@ int ext_flash_write(uintptr_t address, const uint8_t *data, int len)
166166
ck_assert_msg(len >= 0, "ext_flash_write invalid len %d", len);
167167
ck_assert_msg(
168168
((address >= WOLFBOOT_PARTITION_BOOT_ADDRESS) &&
169+
(address < WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE) &&
169170
((uintptr_t)len <=
170171
WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE - address)) ||
171172
((address >= WOLFBOOT_PARTITION_UPDATE_ADDRESS) &&
173+
(address < WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE) &&
172174
((uintptr_t)len <=
173175
WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE - address)) ||
174176
((address >= WOLFBOOT_PARTITION_SWAP_ADDRESS) &&
177+
(address < WOLFBOOT_PARTITION_SWAP_ADDRESS + WOLFBOOT_SECTOR_SIZE) &&
175178
((uintptr_t)len <=
176179
WOLFBOOT_PARTITION_SWAP_ADDRESS + WOLFBOOT_SECTOR_SIZE - address)),
177180
"ext_flash_write address out of range: %p len %d",

0 commit comments

Comments
 (0)