Skip to content
Snippets Groups Projects
Commit 1ef3e39c authored by rswindell's avatar rswindell
Browse files

Use the current thread ID as part of the random number seed.

parent 7aceff8b
No related branches found
No related tags found
No related merge requests found
...@@ -770,7 +770,7 @@ static void pop3_thread(void* arg) ...@@ -770,7 +770,7 @@ static void pop3_thread(void* arg)
memset(&user,0,sizeof(user)); memset(&user,0,sizeof(user));
password[0]=0; password[0]=0;
srand(time(NULL)); /* seed random number generator */ srand(time(NULL) ^ GetCurrentThreadId()); /* seed random number generator */
rand(); /* throw-away first result */ rand(); /* throw-away first result */
safe_snprintf(challenge,sizeof(challenge),"<%x%x%lx%lx@%.128s>" safe_snprintf(challenge,sizeof(challenge),"<%x%x%lx%lx@%.128s>"
,rand(),socket,(ulong)time(NULL),clock(),startup->host_name); ,rand(),socket,(ulong)time(NULL),clock(),startup->host_name);
...@@ -2039,7 +2039,7 @@ static void smtp_thread(void* arg) ...@@ -2039,7 +2039,7 @@ static void smtp_thread(void* arg)
return; return;
} }
srand(time(NULL)); /* seed random number generator */ srand(time(NULL) ^ GetCurrentThreadId()); /* seed random number generator */
rand(); /* throw-away first result */ rand(); /* throw-away first result */
SAFEPRINTF3(session_id,"%x%x%lx",socket,rand(),clock()); SAFEPRINTF3(session_id,"%x%x%lx",socket,rand(),clock());
......
...@@ -265,7 +265,7 @@ static BOOL winsock_startup(void) ...@@ -265,7 +265,7 @@ static BOOL winsock_startup(void)
DLLEXPORT void DLLCALL sbbs_srand() DLLEXPORT void DLLCALL sbbs_srand()
{ {
srand(msclock()); srand(time(NULL) ^ GetCurrentThreadId());
sbbs_random(10); /* Throw away first number */ sbbs_random(10); /* Throw away first number */
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment