diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-27 17:14:10 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-27 17:14:10 +0000 |
| commit | 0cc4ff7b3b732362ee2332669be415a6a1e1d75e (patch) | |
| tree | a1b7cf050d8bd38fc60610d30ce14eae09400f56 | |
| parent | db6e817ded9f99cb4d153ba91f7688874d8c67a1 (diff) | |
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/libreboot-utils/lib/rand.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c index 3155eec3..4c7458c7 100644 --- a/util/libreboot-utils/lib/rand.c +++ b/util/libreboot-utils/lib/rand.c @@ -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; |
