From ddbef023c6e57fd136fd6921366498ecaee39a40 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Sun, 8 Dec 2024 18:49:04 +0100 Subject: [PATCH] flash: trigger failloop if we fail to parse target --- src/core/flash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/flash.c b/src/core/flash.c index d649dea73..b0ddf5c52 100644 --- a/src/core/flash.c +++ b/src/core/flash.c @@ -147,7 +147,11 @@ void flash_load() { cbor_value_t dec; cbor_decoder_init(&dec, buffer, size); - cbor_decode_target_t(&dec, &target); + + cbor_result_t res = cbor_decode_target_t(&dec, &target); + if (res < CBOR_OK) { + failloop(FAILLOOP_FAULT); + } } if (flash_compare_magic(FLASH_STORAGE_OFFSET, (FMC_MAGIC | FLASH_STORAGE_OFFSET))) {