diff options
author | Kim Alvefur <zash@zash.se> | 2014-09-18 10:21:38 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-09-18 10:21:38 +0200 |
commit | 8e74cf8125fdd3cac754f7cdfb4daec62a5a75ea (patch) | |
tree | c8d7c9d192aa84ad70ea4688421f963c9a6ca1be /util | |
parent | bf5828ed5a7cb232ad706112384d611c6accebb1 (diff) | |
download | prosody-8e74cf8125fdd3cac754f7cdfb4daec62a5a75ea.tar.gz prosody-8e74cf8125fdd3cac754f7cdfb4daec62a5a75ea.zip |
util.random: Ensure at least 4 bytes of previous random state is used when generating new randomness
Diffstat (limited to 'util')
-rw-r--r-- | util/random.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/random.lua b/util/random.lua index 328bdb00..5938a94f 100644 --- a/util/random.lua +++ b/util/random.lua @@ -31,8 +31,8 @@ local function seed(x) end local function bytes(n) - if #buffer < n then seed(uniq_time()); end - local r = buffer:sub(0, n); + if #buffer < n+4 then seed(uniq_time()); end + local r = buffer:sub(1, n); buffer = buffer:sub(n+1); return r; end |