summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 17:56:18 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-13 17:56:35 +0000
commit130b25e676cbd69f26d20f3ce13e89805ec583a6 (patch)
tree6bb4cd195f07624fa8f094a4b64beff593f5b369 /util
parentdfbdffc6a620b383f8a2ecb5cf6d564073a4b9a0 (diff)
util/nvmutil: safer offset check (use subtraction)
don't allow overflows Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-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 b917776c..0185150f 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -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)