From e7f84fe6cfac2de3471e4912b1ac82023976ccfa Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Tue, 6 Oct 2026 14:22:07 -0700 Subject: [PATCH] mkimg: Don't ignore invalid partition offsets When handling PART_KIND_FILE, the "error" variable is set to reflect any errors in parsing the specified offset; but that value is then overwritten by the return value of image_copyin. Error out immediately instead. Note that it is not necessary to change the code in PART_KIND_SIZE which parses the size, since in that case we do not overwrite the value in "error". Fixes: 8f3c71c85e5f ("mkimg: Add support for offset if the source is an image") MFC after: 1 week Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D60422 --- usr.bin/mkimg/mkimg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index 9d8c53e262a3..b727b43683a3 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -504,7 +504,7 @@ mkimg(void) else offset++; if (expand_number(offset, &byteoffset) == -1) - error = errno; + err(EX_IOERR, "partition %d", part->index + 1); } /* Work out exactly where the partition starts. */