util/nvmutil: add negative off check to prw

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-13 23:22:21 +00:00
parent 7fe667789a
commit f8ba774796

View File

@@ -1684,6 +1684,7 @@ prw(int fd, void *mem, size_t nrw,
goto err_prw;
if (fd < 0
|| off < 0
|| !nrw /* prevent zero read request */
|| nrw > (size_t)SSIZE_MAX /* prevent overflow */
|| (unsigned int)rw_type > IO_PWRITE)