Changeset

5340:51c9959c21c0

net.dns: Make sure argument to math.randomseed does not overflow a 32 bit unsigned int. Closes #320
author Kim Alvefur <zash@zash.se>
date Tue, 05 Mar 2013 10:04:31 +0100
parents 5339:b5cae12411af
children 5341:760c22c822be
files net/dns.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Fri Mar 01 14:15:38 2013 +0100
+++ b/net/dns.lua	Tue Mar 05 10:04:31 2013 +0100
@@ -223,7 +223,7 @@
 
 
 function dns.random(...)    -- - - - - - - - - - - - - - - - - - -  dns.random
-	math.randomseed(math.floor(10000*socket.gettime()));
+	math.randomseed(math.floor(10000*socket.gettime()) % 0x100000000);
 	dns.random = math.random;
 	return dns.random(...);
 end