diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:00:20 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:00:20 +0000 |
| commit | 19ee28161e6e3ddd2185916d45271b79b04d4bf6 (patch) | |
| tree | 20b0c94452614b691054e3a5bbe358dbc7ae9862 /util | |
| parent | 6d27853f565439ca37c573585c1dab639015f892 (diff) | |
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 <leah@libreboot.org>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
