Skip to content

Commit f7789c9

Browse files
abonislawskikv2019i
authored andcommitted
rimage: fix CSE header detection check when re-signing
Test the outcome of the scan instead of the loop index, so the check no longer depends on the loop bound, and align the message with the one used by verify_image(). Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent c086688 commit f7789c9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎tools/rimage/src/manifest.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,12 @@ int resign_image(struct image *image)
17911791
}
17921792
}
17931793

1794-
if (i >= size) {
1795-
fprintf(stderr, "error: didn't found header marker %d\n", i);
1794+
/* the scan stops a full marker before the end, so a trailing partial word
1795+
* leaves the loop index below the size; test the result of the scan itself
1796+
*/
1797+
if (!image->fw_image) {
1798+
fprintf(stderr, "error: could not find valid CSE header $CPD in %s\n",
1799+
image->in_file);
17961800
ret = -EINVAL;
17971801
goto out;
17981802
}

0 commit comments

Comments
 (0)