util/nvmutil: safer offset check (use subtraction)

don't allow overflows

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-13 17:56:18 +00:00
parent abc484713a
commit 888107764d
+1 -1
View File
@@ -1764,7 +1764,7 @@ io_args(int fd, void *mem, size_t nrw,
if (off < 0 || off >= gbe_file_size)
goto err_io_args;
if ((off_t)(off + nrw) > gbe_file_size)
if (nrw > (size_t)(gbe_file_size - off))
goto err_io_args;
if (nrw > GBE_PART_SIZE)