diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-26 08:59:03 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 08:59:03 +0000 |
| commit | d6087901c107d45123a57d5fc905314aac7969c7 (patch) | |
| tree | ea2764930590ca330f62e9460242a32fa39b34ee | |
| parent | cf16d07df97b8fbec9fe17b3f437ffc297af9ed2 (diff) | |
rand/libreboot/utils: prevent div by zero
not really a thing. bufsiz would never be zero,
unless the demon takes over linux
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/libreboot-utils/lib/rand.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c index 06d5f49e..3b20ab65 100644 --- a/util/libreboot-utils/lib/rand.c +++ b/util/libreboot-utils/lib/rand.c @@ -72,6 +72,12 @@ * or your program dies. */ +#ifndef BUFSIZ +#define BUFSIZ 8192 /* reasonably on modern 64-bit systems */ +#elif (BUFSIZ <= 0) +#error defined buffer size BUFSIZ below or equal to zero +#endif + int win_lottery(char **buf) /* are u lucky? */ { |
