util/nvmutil: fix randomness in mkstemp

i need to re-initialise r each time.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-17 17:36:11 +00:00
parent 4688dee7cb
commit b6d176189e
+4 -2
View File
@@ -2613,7 +2613,7 @@ x_i_mkstemp(char *template)
char *p;
char ch[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
unsigned long r = rlong();
unsigned long r;
len = xstrxlen(template, PATH_LEN);
@@ -2625,8 +2625,10 @@ x_i_mkstemp(char *template)
for (i = 0; i < 100; i++) {
for (j = 0; j < 6; j++)
for (j = 0; j < 6; j++) {
r = rlong();
p[j] = ch[r % (sizeof(ch) - 1)];
}
fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600);