summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 22:50:06 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commit1583947625a070f71541724cbf5f0765c9771d89 (patch)
tree463888363414e4d530a2af14ed8f0f68f01b312e
parente4802d4013e26acd0090066145298bfefb9d13b0 (diff)
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>
-rw-r--r--util/nvmutil/nvmutil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 9218b827..ee17b2f7 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -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);