diff options
| author | Pali Rohár <[email protected]> | 2021-07-23 11:14:22 +0200 |
|---|---|---|
| committer | Stefan Roese <[email protected]> | 2021-07-31 09:49:32 +0200 |
| commit | 5029d7bf34ec14730faa74d0fa1a229ec21233c9 (patch) | |
| tree | 3e696c45562c44bdcefc61991ab7113e5c386965 /tools | |
| parent | 825a2ca023202f73a09660db7a49ac1109917ce8 (diff) | |
tools: kwboot: Fix checking image header version
Function image_version() returns unsigned value, so it can never be
negative. Explicitly check for two supported image versions: v0 and v1.
Signed-off-by: Pali Rohár <[email protected]>
Reviewed-by: Marek Behún <[email protected]>
Reviewed-by: Stefan Roese <[email protected]>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/kwboot.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c index 1d32c1b7ad2..7feeaa45a22 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -634,7 +634,7 @@ kwboot_img_patch_hdr(void *img, size_t size) } image_ver = image_version(img); - if (image_ver < 0) { + if (image_ver != 0 && image_ver != 1) { fprintf(stderr, "Invalid image header version\n"); errno = EINVAL; goto out; |
