1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-20 21:29:06 +00:00

potential fix for the Nbase get_random_bytes() bug on Windows

This commit is contained in:
fyodor
2008-04-24 03:23:01 +00:00
parent f8b3f905c7
commit 884395da68
2 changed files with 6 additions and 5 deletions

View File

@@ -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);

View File

@@ -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();