summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-10 14:15:34 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-10 14:18:19 +0000
commitc953228bb002059faa92b9e000303099d80b9091 (patch)
tree7ce921f2341a921b9b36ce7a2806dee17e592c89
parent883860d6874816f6788adedab5f53b4eae3c0bf2 (diff)
util/nvmutil: fix possible overflow: gbe_x_offset
preventative fix, since the values are currently quite tiny. this new check is the same, but goes the other way to eliminate overflow. 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 5de1f35f..0101888e 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1318,7 +1318,7 @@ gbe_x_offset(size_t p, const char *f_op, const char *d_type,
off = ((off_t)p) * (off_t)nsize;
- if (off + GBE_PART_SIZE > ncmp)
+ if (off > ncmp - GBE_PART_SIZE)
err(errno, "%s: GbE %s %s out of bounds",
fname, d_type, f_op);