From: Victor Julien Date: Fri, 13 May 2016 16:35:26 +0000 (+0200) Subject: thread storage: fix memset 0 after realloc X-Git-Tag: suricata-3.1RC1~150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90414472eda57134ca58cb9f338df2d169520896;p=thirdparty%2Fsuricata.git thread storage: fix memset 0 after realloc Thread storage expansion would not properly memset 0 the new part of the memory. --- diff --git a/src/tm-threads.c b/src/tm-threads.c index b21770e4ea..1d7b5fe149 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -2283,7 +2283,7 @@ int TmThreadsRegisterThread(ThreadVars *tv, const int type) void *newmem = SCRealloc(thread_store.threads, ((thread_store.threads_size + STEP) * sizeof(Thread))); BUG_ON(newmem == NULL); thread_store.threads = newmem; - memset((uint8_t *)thread_store.threads + (thread_store.threads_size * sizeof(Thread)), 0x00, STEP); + memset((uint8_t *)thread_store.threads + (thread_store.threads_size * sizeof(Thread)), 0x00, STEP * sizeof(Thread)); Thread *t = &thread_store.threads[thread_store.threads_size]; t->name = tv->name;