From 42ab1ad43b330c7849f593406b36a8945fafe71a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 14 Aug 2017 21:59:44 +0100 Subject: [PATCH] [Minor] Randomize Lua PRNG at startup --- src/lua/lua_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 6c640eec3..baab27226 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -374,6 +374,14 @@ rspamd_lua_init () lua_newtable (L); lua_setglobal (L, "rspamd_plugins"); + /* Set PRNG */ + lua_getglobal (L, "math"); + lua_pushstring (L, "randomseed"); + lua_gettable (L, -2); + lua_pushnumber (L, ottery_rand_uint64 ()); + lua_pcall (L, 1, 0, 0); + lua_pop (L, 1); /* math table */ + return L; } -- 2.39.5