From 884395da687bc7ef4fca543a268f7755e76ee93a Mon Sep 17 00:00:00 2001 From: fyodor Date: Thu, 24 Apr 2008 03:23:01 +0000 Subject: [PATCH] potential fix for the Nbase get_random_bytes() bug on Windows --- main.cc | 5 ----- nmap.cc | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.cc b/main.cc index c9971cdef..3019db1ae 100644 --- a/main.cc +++ b/main.cc @@ -157,7 +157,6 @@ int main(int argc, char *argv[]) { char *endptr; int interactivemode = 0; int fd; - struct timeval tv; int arglen = 0; #ifdef __amigaos__ @@ -180,10 +179,6 @@ int main(int argc, char *argv[]) { mtrace(); #endif - /* You never know when "random" numbers will come in handy ... */ - gettimeofday(&tv, NULL); - srand((tv.tv_sec ^ tv.tv_usec) ^ getpid()); - /* Trap these sigs for cleanup */ #if HAVE_SIGNAL signal(SIGINT, sigdie); diff --git a/nmap.cc b/nmap.cc index 55787c549..b2b30653e 100644 --- a/nmap.cc +++ b/nmap.cc @@ -505,6 +505,7 @@ int nmap_main(int argc, char *argv[]) { size_t sslen; int option_index; bool iflist = false; + struct timeval tv; // Pre-specified timing parameters. // These are stored here during the parsing of the arguments so that we can @@ -647,6 +648,11 @@ int nmap_main(int argc, char *argv[]) { fakeargv[argc] = NULL; if (argc < 2 ) printusage(argv[0], -1); + + /* You never know when "random" numbers will come in handy ... */ + gettimeofday(&tv, NULL); + srand((tv.tv_sec ^ tv.tv_usec) ^ getpid() + 31337); + Targets.reserve(100); #ifdef WIN32 win_pre_init();