util/nvmutil: fix theoretical buffer overflow

i already guard offsets in io_args, but it's best
to be thorough here.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-15 01:14:29 +00:00
parent f509c87d04
commit 53434e24a0

View File

@@ -1917,6 +1917,8 @@ rw_file_exact(int fd, u8 *mem, size_t nrw,
mem_cur = (void *)(mem + (size_t)rc);
nrw_cur = (size_t)(nrw - (size_t)rc);
if (off < 0)
goto err_rw_file_exact;
off_cur = (off_t)((size_t)off + (size_t)rc);
rv = prw(fd, mem_cur, nrw_cur, off_cur,