summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-02 17:47:58 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-02 17:47:58 +0000
commit589ac92781ab62cc265e32568b7b33c5f281cbe8 (patch)
tree05c5acf5c75eea40049e37799ddf8c0dc4729c2a /util/nvmutil
parent51e4e43c94c577916cd5976266e15e794d55ea96 (diff)
util/nvmutil: fix bad bound checkHEADmaster
the current check is too liberal. make it sticter. the issue is that the previous check did not take into account that it's a check on a uint16_t array, against nf which refers to a number of bytes. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-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 f86e88bf..0d9020ee 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -425,7 +425,7 @@ check_bounds(int c, int p)
{
if ((p != 0) && (p != 1))
err(SET_ERR(EINVAL), "check_bounds: invalid partnum %d", p);
- if ((c < 0) || (c > nf))
+ if ((c < 0) || (c > ((nf >> 1) - 1)))
err(SET_ERR(EINVAL), "check_bounds: out of bounds %d", c);
}