mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/libreboot-utils: fix div by zero in rsize
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -83,6 +83,9 @@ size_t
|
||||
rsize(size_t n)
|
||||
{
|
||||
size_t rval = SIZE_MAX;
|
||||
if (!n)
|
||||
err_no_cleanup(0, EFAULT, "rsize: division by zero");
|
||||
|
||||
for (; rval >= SIZE_MAX - (SIZE_MAX % n); rset(&rval, sizeof(rval)));
|
||||
|
||||
return rval % n;
|
||||
|
||||
Reference in New Issue
Block a user