util/nvmutil: rw_over_nrw: err if nrw is zero

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-14 23:26:54 +00:00
parent 9d7e990df4
commit 4db11cd4ed

View File

@@ -2149,6 +2149,14 @@ err_is_file:
static ssize_t
rw_over_nrw(ssize_t r, size_t nrw)
{
/*
* If a byte length of zero
* was requested, that is
* clearly a bug. No way.
*/
if (!nrw)
goto err_rw_over_nrw;
if (r == -1)
return r;