From 90414472eda57134ca58cb9f338df2d169520896 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 13 May 2016 18:35:26 +0200 Subject: [PATCH] thread storage: fix memset 0 after realloc Thread storage expansion would not properly memset 0 the new part of the memory. --- src/tm-threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;