diff --git a/src/defrag-hash.c b/src/defrag-hash.c index e37a08738d..284b582f6e 100644 --- a/src/defrag-hash.c +++ b/src/defrag-hash.c @@ -132,10 +132,11 @@ void DefragInitConfig(char quiet) SC_ATOMIC_INIT(defragtracker_prune_idx); DefragTrackerQueueInit(&defragtracker_spare_q); +#ifndef AFLFUZZ_NO_RANDOM unsigned int seed = RandomTimePreseed(); /* set defaults */ defrag_config.hash_rand = (int)(DEFRAG_DEFAULT_HASHSIZE * (rand_r(&seed) / RAND_MAX + 1.0)); - +#endif defrag_config.hash_size = DEFRAG_DEFAULT_HASHSIZE; defrag_config.memcap = DEFRAG_DEFAULT_MEMCAP; defrag_config.prealloc = DEFRAG_DEFAULT_PREALLOC; diff --git a/src/flow.c b/src/flow.c index fa8b21ba95..4cedf2685d 100644 --- a/src/flow.c +++ b/src/flow.c @@ -355,10 +355,11 @@ void FlowInitConfig(char quiet) FlowQueueInit(&flow_spare_q); FlowQueueInit(&flow_recycle_q); +#ifndef AFLFUZZ_NO_RANDOM unsigned int seed = RandomTimePreseed(); /* set defaults */ flow_config.hash_rand = (int)( FLOW_DEFAULT_HASHSIZE * (rand_r(&seed) / RAND_MAX + 1.0)); - +#endif flow_config.hash_size = FLOW_DEFAULT_HASHSIZE; flow_config.memcap = FLOW_DEFAULT_MEMCAP; flow_config.prealloc = FLOW_DEFAULT_PREALLOC; diff --git a/src/host.c b/src/host.c index a28639cce4..faf9513bde 100644 --- a/src/host.c +++ b/src/host.c @@ -141,10 +141,11 @@ void HostInitConfig(char quiet) SC_ATOMIC_INIT(host_prune_idx); HostQueueInit(&host_spare_q); +#ifndef AFLFUZZ_NO_RANDOM unsigned int seed = RandomTimePreseed(); /* set defaults */ host_config.hash_rand = (int)( HOST_DEFAULT_HASHSIZE * (rand_r(&seed) / RAND_MAX + 1.0)); - +#endif host_config.hash_size = HOST_DEFAULT_HASHSIZE; host_config.memcap = HOST_DEFAULT_MEMCAP; host_config.prealloc = HOST_DEFAULT_PREALLOC; diff --git a/src/ippair.c b/src/ippair.c index 79ecb76ca8..736cdce5ba 100644 --- a/src/ippair.c +++ b/src/ippair.c @@ -137,10 +137,11 @@ void IPPairInitConfig(char quiet) SC_ATOMIC_INIT(ippair_prune_idx); IPPairQueueInit(&ippair_spare_q); +#ifndef AFLFUZZ_NO_RANDOM unsigned int seed = RandomTimePreseed(); /* set defaults */ ippair_config.hash_rand = (int)( IPPAIR_DEFAULT_HASHSIZE * (rand_r(&seed) / RAND_MAX + 1.0)); - +#endif ippair_config.hash_size = IPPAIR_DEFAULT_HASHSIZE; ippair_config.memcap = IPPAIR_DEFAULT_MEMCAP; ippair_config.prealloc = IPPAIR_DEFAULT_PREALLOC; diff --git a/src/suricata-common.h b/src/suricata-common.h index 18791c3b04..4910c4185d 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -228,6 +228,8 @@ #endif #endif +#define AFLFUZZ_NO_RANDOM 1 + /* we need this to stringify the defines which are supplied at compiletime see: http://gcc.gnu.org/onlinedocs/gcc-3.4.1/cpp/Stringification.html#Stringification */ #define xstr(s) str(s)