summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 17:52:23 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commite1cd978f01d76c598f6f0f5ab9c73e3051701115 (patch)
tree972290aa7266fe4037ed1c6534d1b445e960bdae /util/nvmutil/nvmutil.c
parent5f8593b5810809b0694fa28e29fdddee474c4fd8 (diff)
util/nvmutil: check overflow in io_args
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index f586e199..e5a21afc 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1761,6 +1761,9 @@ 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)
+ goto err_io_args;
+
if (nrw > GBE_PART_SIZE)
goto err_io_args;