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:		8f3c71c85e ("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
This commit is contained in:
Colin Percival committed 2026-10-21 12:42:43 -07:00
1 parent 38407c46de
commit e7f84fe6cf
1 file changed
+1 -1
+1 -1
View File
@@ -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. */