]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
thread storage: fix memset 0 after realloc
authorVictor Julien <victor@inliniac.net>
Fri, 13 May 2016 16:35:26 +0000 (18:35 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 17 May 2016 10:35:18 +0000 (12:35 +0200)
Thread storage expansion would not properly memset 0 the new part
of the memory.

src/tm-threads.c

index b21770e4ea7c7cae3b80d2482b83a01af9e418c9..1d7b5fe149cc46f8dfae25a1c457477c4091dac5 100644 (file)
@@ -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;