summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 22:50:06 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-14 22:50:06 +0000
commit7c79db20e3e8667a26be691e5bcb7d5fb1737e27 (patch)
tree61ff3eec7a80a14d43adb02302ca321df53107cc /util/nvmutil/nvmutil.c
parentef4e9dc895e3e2454c904548a7d0e78235a1767f (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>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-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);