summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 19:51:46 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commit34f26319d7a356a171c3e41f23db92b3558908c6 (patch)
tree2b19643cad97d19a310d5fb175e1ccce612722af /util/libreboot-utils/lib
parentbce109950964d0b24646f8acca2bc78c1975edfe (diff)
lbutils, rand: err on zero return (fatal)
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib')
-rw-r--r--util/libreboot-utils/lib/rand.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c
index b5d6d459..5bf03239 100644
--- a/util/libreboot-utils/lib/rand.c
+++ b/util/libreboot-utils/lib/rand.c
@@ -70,6 +70,9 @@ retry_rand:
goto err; /* possibly unsupported by kernel */
}
+ if (rc == 0)
+ goto err; /* prevent infinite loop on fatal err */
+
if ((off += (size_t)rc) < n)
goto retry_rand;