summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/rand.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 19:30:06 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commit0d86fd38df19589afe98aa7d75cdd4460b678b49 (patch)
tree7038c705d626992a4f55c3810d1f5ac350ec9f36 /util/libreboot-utils/lib/rand.c
parenta6f76ac4ee922717ee597d7687b3b17c8082d644 (diff)
fix offset on urandom falback
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/rand.c')
-rw-r--r--util/libreboot-utils/lib/rand.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c
index 9cb52386..11d99ffa 100644
--- a/util/libreboot-utils/lib/rand.c
+++ b/util/libreboot-utils/lib/rand.c
@@ -52,7 +52,7 @@ rset(void *buf, size_t n)
if ((fd = open("/dev/urandom", O_RDONLY)) < 0)
goto err;
retry_rand:
- if ((rc = read(fd, buf, n)) < 0) {
+ if ((rc = read(fd, buf + off, n - off)) < 0) {
#elif defined(__linux__)
retry_rand:
if ((rc = (ssize_t)syscall(SYS_getrandom,