summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 23:22:21 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-13 23:22:21 +0000
commitf8ba774796f43f668ac6ee810ca1057037c72c9e (patch)
tree82ddf5a5344720ad18c376042542ace8aac945cc
parent7fe667789a0ac6e75b805ae5f51a8c332fe5090c (diff)
util/nvmutil: add negative off check to prw
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index fa8a7020..410f0886 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1684,6 +1684,7 @@ prw(int fd, void *mem, size_t nrw,
goto err_prw;
if (fd < 0
+ || off < 0
|| !nrw /* prevent zero read request */
|| nrw > (size_t)SSIZE_MAX /* prevent overflow */
|| (unsigned int)rw_type > IO_PWRITE)