|
|
cb4ff2 |
commit e1df30fbc2e2167a982c0e77a7ebee28f4dd0800
|
|
|
cb4ff2 |
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
cb4ff2 |
Date: Thu Jul 25 11:22:17 2019 -0300
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
Get new entropy on each attempt __gen_tempname (BZ #15813)
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
This is missing bit for fully fix BZ#15813 (the other two were fixed
|
|
|
cb4ff2 |
by 359653aaacad463).
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
Checked on x86_64-linux-gnu.
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
[BZ #15813]
|
|
|
cb4ff2 |
sysdeps/posix/tempname.c (__gen_tempname): get entrypy on each
|
|
|
cb4ff2 |
attempt.
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
|
|
|
cb4ff2 |
index 3d26f378021680ae..61d7a9f36d37abae 100644
|
|
|
cb4ff2 |
--- a/sysdeps/posix/tempname.c
|
|
|
cb4ff2 |
+++ b/sysdeps/posix/tempname.c
|
|
|
cb4ff2 |
@@ -186,7 +186,6 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
|
|
cb4ff2 |
{
|
|
|
cb4ff2 |
int len;
|
|
|
cb4ff2 |
char *XXXXXX;
|
|
|
cb4ff2 |
- uint64_t value;
|
|
|
cb4ff2 |
unsigned int count;
|
|
|
cb4ff2 |
int fd = -1;
|
|
|
cb4ff2 |
int save_errno = errno;
|
|
|
cb4ff2 |
@@ -218,13 +217,13 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
|
|
cb4ff2 |
/* This is where the Xs start. */
|
|
|
cb4ff2 |
XXXXXX = &tmpl[len - 6 - suffixlen];
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
- /* Get some more or less random data. */
|
|
|
cb4ff2 |
- RANDOM_BITS (value);
|
|
|
cb4ff2 |
- value ^= (uint64_t)__getpid () << 32;
|
|
|
cb4ff2 |
-
|
|
|
cb4ff2 |
- for (count = 0; count < attempts; value += 7777, ++count)
|
|
|
cb4ff2 |
+ uint64_t pid = (uint64_t) __getpid () << 32;
|
|
|
cb4ff2 |
+ for (count = 0; count < attempts; ++count)
|
|
|
cb4ff2 |
{
|
|
|
cb4ff2 |
- uint64_t v = value;
|
|
|
cb4ff2 |
+ uint64_t v;
|
|
|
cb4ff2 |
+ /* Get some more or less random data. */
|
|
|
cb4ff2 |
+ RANDOM_BITS (v);
|
|
|
cb4ff2 |
+ v ^= pid;
|
|
|
cb4ff2 |
|
|
|
cb4ff2 |
/* Fill in the random bits. */
|
|
|
cb4ff2 |
XXXXXX[0] = letters[v % 62];
|