diff --git a/random.c b/random.c index cbbe01623cd79c4efe70da29081efd8a8918f06d..5953a4374f991ecddc7d5dbffb5399be42887e76 100644 --- a/random.c +++ b/random.c @@ -31,7 +31,8 @@ static int donerandinit = 0; /* this is used to generate unique output from the same hashpool */ static uint32_t counter = 0; -#define MAX_COUNTER 1<<31 /* the max value for the counter, so it won't loop */ +/* the max value for the counter, so it won't integer overflow */ +#define MAX_COUNTER 1<<30 static unsigned char hashpool[SHA1_HASH_SIZE]; @@ -167,7 +168,6 @@ void reseedrandom() { gettimeofday(&tv, NULL); hash_state hs; - unsigned char hash[SHA1_HASH_SIZE]; sha1_init(&hs); sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); sha1_process(&hs, (void*)&pid, sizeof(pid)); diff --git a/svr-main.c b/svr-main.c index e06eb5e116b6f283b9cc9326517f78c4f7d31e58..e00de6b2bdb852ca74b8da39b6c7e826c2355818 100644 --- a/svr-main.c +++ b/svr-main.c @@ -28,6 +28,7 @@ #include "buffer.h" #include "signkey.h" #include "runopts.h" +#include "random.h" static size_t listensockets(int *sock, size_t sockcount, int *maxfd); static void sigchld_handler(int dummy);