Comparison

net/dns.lua @ 6645:4f934cf03bc9

net.dns: Make sure argument to math.randomseed does not overflow a 32 bit *signed* int (blame Lua). Closes #439
author Kim Alvefur <zash@zash.se>
date Sun, 26 Apr 2015 19:50:24 +0200
parent 6631:45222bfb206f
child 6646:9795b8cf14f1
child 6863:88d54bec26b7
comparison
equal deleted inserted replaced
6644:6cb6855f60df 6645:4f934cf03bc9
223 223
224 -- packet layer -------------------------------------------------- packet layer 224 -- packet layer -------------------------------------------------- packet layer
225 225
226 226
227 function dns.random(...) -- - - - - - - - - - - - - - - - - - - dns.random 227 function dns.random(...) -- - - - - - - - - - - - - - - - - - - dns.random
228 math.randomseed(math.floor(10000*socket.gettime()) % 0x100000000); 228 math.randomseed(math.floor(10000*socket.gettime()) % 0x80000000);
229 dns.random = math.random; 229 dns.random = math.random;
230 return dns.random(...); 230 return dns.random(...);
231 end 231 end
232 232
233 233