From b6df4ec38878c758cc1a03ef116ab78ef1a0d445 Mon Sep 17 00:00:00 2001 From: Joel Guittet Date: Fri, 17 Mar 2023 22:08:52 +0100 Subject: [PATCH] hawkbit: check mcuboot header version Checking mcuboot header version prior to use the content of the header structure. Signed-off-by: Joel Guittet --- subsys/mgmt/hawkbit/hawkbit_firmware.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/mgmt/hawkbit/hawkbit_firmware.c b/subsys/mgmt/hawkbit/hawkbit_firmware.c index 110d63c5209..f070fa65ea5 100644 --- a/subsys/mgmt/hawkbit/hawkbit_firmware.c +++ b/subsys/mgmt/hawkbit/hawkbit_firmware.c @@ -17,6 +17,10 @@ bool hawkbit_get_firmware_version(char *version, int version_len) return false; } + if (header.mcuboot_version != 1) { + return false; + } + snprintk(version, version_len, "%d.%d.%d", header.h.v1.sem_ver.major, header.h.v1.sem_ver.minor, header.h.v1.sem_ver.revision);