From d6087901c107d45123a57d5fc905314aac7969c7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 26 Mar 2026 08:59:03 +0000 Subject: 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 --- util/libreboot-utils/lib/rand.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'util/libreboot-utils/lib/rand.c') 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? */ { -- cgit v1.2.1