util/nvmutil: fix potential overflow in rw

off is signed, so converting that to unsigned
is better than converting rc (unsigned)
to signed. i had the right idea, but got
it wrong in the earlier version. this
should fix potential overflow issues.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-14 22:50:06 +00:00
parent ef4e9dc895
commit 7c79db20e3

View File

@@ -1894,7 +1894,7 @@ rw_file_exact(int fd, u8 *mem, size_t nrw,
rv = prw(fd,
mem + (size_t)rc,
nrw - (size_t)rc,
off + (off_t)rc,
(size_t)off + rc,
rw_type, loop_eagain, loop_eintr,
OFF_ERR);