diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-28 01:35:01 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-28 01:35:01 +0000 |
commit | 74222fc0963fece65e1f31524f209c00ce8941bc (patch) | |
tree | b68469031481704939f2e4cc49773a2147451967 /src | |
parent | 074ac59f6f239256161a1de202bdd5551dfb26fd (diff) | |
download | rspamd-74222fc0963fece65e1f31524f209c00ce8941bc.tar.gz rspamd-74222fc0963fece65e1f31524f209c00ce8941bc.zip |
Ouch.
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c index db7529a92..776e807d1 100644 --- a/src/util.c +++ b/src/util.c @@ -2401,7 +2401,6 @@ rspamd_random_bytes (gchar *buf, gsize buflen) { gint fd; gsize i; - time_t t; #ifdef HAVE_OPENSSL /* Init random generator */ @@ -2426,12 +2425,9 @@ fallback: close (fd); } /* No /dev/random */ - for (i = 0; i < buflen;) { - /* Place least significant byte to the beginning */ - t = time (NULL); - t = GLONG_TO_BE (t); - memcpy (&buf[i], &t, MIN (sizeof (t), buflen - i)); - i += sizeof (t); + g_random_set_seed (time (NULL)); + for (i = 0; i < buflen; i ++) { + buf[i] = g_random_int () & 0xff; } } |