summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-18 04:45:53 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commit21cd0b7a91e6f3e2471a3ffa7b90082dc6a26412 (patch)
tree78b0d7045f4557832983ea48aa4204c0c9aa1408
parent65ed83d2e763a54676c86768956edfa5bbba137d (diff)
nvmutil: fix modulo bias in mkstemp
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 34b6f38b..c34d79c3 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -2908,7 +2908,7 @@ x_i_mkstemp(char *template)
for (j = 0; j < 6; j++) {
r = rlong();
- p[j] = ch[r % (sizeof(ch) - 1)];
+ p[j] = ch[(unsigned long)(r >> 1) % (sizeof(ch) - 1)];
}
fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600);