hawkbit: check mcuboot header version

Checking mcuboot header version prior to use the content of the header
structure.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
This commit is contained in:
Joel Guittet 2023-03-17 22:08:52 +01:00 committed by Carles Cufí
parent a3d7fdafd6
commit b6df4ec388
1 changed files with 4 additions and 0 deletions

View File

@ -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);