diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-17 17:36:11 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 06:59:42 +0000 |
| commit | b6d176189eb0cfabfb36e47ae39c88d0496b325e (patch) | |
| tree | 01b6761d235012eff9d4629c01fc234bad6a9f96 /util/nvmutil | |
| parent | 4688dee7cbc114e526b1fbfcabda06bfc352ce19 (diff) | |
util/nvmutil: fix randomness in mkstemp
i need to re-initialise r each time.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index f6374a7a..e536e273 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -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); |
