diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-13 17:56:18 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 06:59:41 +0000 |
| commit | 888107764d8e8a9da21f2cef9a4474363b462a35 (patch) | |
| tree | f056139357e062bd2089000348d273517a783feb /util/nvmutil | |
| parent | abc484713afb36475acc7143b70dc6db2a660d02 (diff) | |
util/nvmutil: safer offset check (use subtraction)
don't allow overflows
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -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 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) |
