Diff

net/dns.lua @ 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
parent 5267:a2080e5c4eda
child 5566:74ae3e7e8779
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