From 130b25e676cbd69f26d20f3ce13e89805ec583a6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 13 Mar 2026 17:56:18 +0000 Subject: util/nvmutil: safer offset check (use subtraction) don't allow overflows Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b917776c..0185150f 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1764,7 +1764,7 @@ 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) + if (nrw > (size_t)(gbe_file_size - off)) goto err_io_args; if (nrw > GBE_PART_SIZE) -- cgit v1.2.1