From 19ee28161e6e3ddd2185916d45271b79b04d4bf6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 10 Mar 2026 10:00:20 +0000 Subject: util/nvmutil: fix rc overflow bug in rw_file_exact check that it's below len, not above it. that way, it will now exit if it goes above (which it shouldn't, but it theoretically could if the code was changed and there was a regression or subtle edge case) 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 295f13e6..34b48504 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1331,7 +1331,7 @@ rw_file_exact(int fd, uint8_t *mem, size_t len, "%s: %s: Requested length (%lu) exceeds SSIZE_MAX (%zd)", path, rw_type_str, len, SSIZE_MAX); - for (rc = 0; rc != len; rc += rval) { + for (rc = 0; rc < len; rc += rval) { if (rw_type == PSCHREIB) rval = prw(fd, mem + rc, len - rc, off + rc, rw_type, path); -- cgit v1.2.1