From 589ac92781ab62cc265e32568b7b33c5f281cbe8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 2 Mar 2026 17:47:58 +0000 Subject: util/nvmutil: fix bad bound check 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 --- util/nvmutil/nvmutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/nvmutil/nvmutil.c') 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); } -- cgit v1.2.1