diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-17 17:36:11 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-17 17:36:11 +0000 |
| commit | 15b8cd7833d4a7dc0967433ff75f3900911a9a87 (patch) | |
| tree | 87d44a860b451931c46eff6ae2b5b0131ae2d034 | |
| parent | 0db9cc321f11cb231ba609e53bcc790d3171e1d4 (diff) | |
util/nvmutil: fix randomness in mkstemp
i need to re-initialise r each time.
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -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); |
