summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-01-22 11:10:43 +0100
committerantirez <antirez@gmail.com>2015-01-22 11:12:28 +0100
commit71da1b15c89d8623985f85b7deae5cfcb727ed4a (patch)
tree0470e8e09d9d91c4e47a707af51920f2cc67404b
parent4e73b305f0fb49a6293c8ade98a6cae3db7939d8 (diff)
downloadredis-71da1b15c89d8623985f85b7deae5cfcb727ed4a.tar.gz
The seed must be static in getRandomHexChars().
-rw-r--r--src/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 6ea16678d..c5386f3a3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -431,10 +431,10 @@ int d2string(char *buf, size_t len, double value) {
void getRandomHexChars(char *p, unsigned int len) {
char *charset = "0123456789abcdef";
unsigned int j;
- unsigned char seed[20]; /* A seed to have a different sequence each run. */
/* Global state. */
static int seed_initialized = 0;
+ static unsigned char seed[20]; /* The SHA1 seed, from /dev/urandom. */
static uint64_t counter = 0; /* The counter we hash with the seed. */
if (!seed_initialized) {