Comparison

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
comparison
equal deleted inserted replaced
5339:b5cae12411af 5340:51c9959c21c0
221 221
222 -- packet layer -------------------------------------------------- packet layer 222 -- packet layer -------------------------------------------------- packet layer
223 223
224 224
225 function dns.random(...) -- - - - - - - - - - - - - - - - - - - dns.random 225 function dns.random(...) -- - - - - - - - - - - - - - - - - - - dns.random
226 math.randomseed(math.floor(10000*socket.gettime())); 226 math.randomseed(math.floor(10000*socket.gettime()) % 0x100000000);
227 dns.random = math.random; 227 dns.random = math.random;
228 return dns.random(...); 228 return dns.random(...);
229 end 229 end
230 230
231 231