imgmgr; imgmgr_read_info() was not checking image header magic unless
the optional ver parameter was passed in.
@@ -152,10 +152,13 @@ imgr_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
goto end;
}
- if (ver != NULL) {
+ if (ver) {
memset(ver, 0xff, sizeof(*ver));
+ }
if (hdr->ih_magic == IMAGE_MAGIC) {
+ if (ver) {
memcpy(ver, &hdr->ih_ver, sizeof(*ver));
+ }
} else if (hdr->ih_magic == 0xffffffff) {
rc = 2;
goto end;
@@ -163,7 +166,6 @@ imgr_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
rc = 1;
goto end;
}
- }
if (flags) {
*flags = hdr->ih_flags;
