Addressed copilot's comments

pull/751/head
Daniele Lacamera 2026-04-15 18:32:25 +02:00
parent 3118f7ad4e
commit 26552b5aed
4 changed files with 4 additions and 0 deletions

View File

@ -1401,6 +1401,7 @@ int wolfBoot_dualboot_candidate(void)
if (fallback_v < candidate_v) {
wolfBoot_printf("Rollback to lower version not allowed\n");
wolfBoot_erase_partition(candidate);
return -1;
}
#endif

View File

@ -62,6 +62,7 @@ void RAMFUNCTION wolfBoot_start(void)
if ((max_v > 0U) && (active_v < max_v)) {
wolfBoot_printf("Rollback to lower version not allowed\n");
boot_panic();
continue;
}
#endif
if ((wolfBoot_open_image(&fw_image, active) < 0)

View File

@ -210,6 +210,7 @@ START_TEST(test_invalid_update_rollback_to_older_boot_is_denied)
ck_assert_int_eq(wolfBoot_staged_ok, 0);
ck_assert_int_eq(wolfBoot_panicked, 1);
ck_assert_ptr_eq((void *)wolfBoot_stage_address, (void *)0xFFFFFFFF);
cleanup_flash();
}
END_TEST

View File

@ -380,6 +380,7 @@ START_TEST (test_invalid_update_type) {
wolfBoot_start();
ck_assert(!wolfBoot_staged_ok);
ck_assert_int_eq(wolfBoot_panicked, 1);
ck_assert_int_eq(get_version_ramloaded(), 2);
cleanup_flash();
}