From 38a5e39922a8696a63a7c6c9900361af128d7e74 Mon Sep 17 00:00:00 2001 From: Walter Karas Date: Tue, 15 Dec 2020 11:36:58 -0600 Subject: [PATCH] Eliminate dangling pointer into stack space. --- include/tscore/ink_queue.h | 3 +++ proxy/logging/Log.cc | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/tscore/ink_queue.h b/include/tscore/ink_queue.h index d1806bc1413..cf6b04f2f16 100644 --- a/include/tscore/ink_queue.h +++ b/include/tscore/ink_queue.h @@ -211,7 +211,10 @@ struct InkAtomicList { #define INK_ATOMICLIST_EMPTY(_x) (!((FREELIST_POINTER((_x.head))))) #endif +// WARNING: the "name" string is not copied, it has to be a statically-stored constant string. +// inkcoreapi void ink_atomiclist_init(InkAtomicList *l, const char *name, uint32_t offset_to_next); + inkcoreapi void *ink_atomiclist_push(InkAtomicList *l, void *item); void *ink_atomiclist_pop(InkAtomicList *l); inkcoreapi void *ink_atomiclist_popall(InkAtomicList *l); diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index 87e19e2a998..61307e0abc2 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -1116,11 +1116,9 @@ Log::create_threads() flush_notify = new EventNotify; flush_data_list = new InkAtomicList; - sprintf(desc, "Logging flush buffer list"); - ink_atomiclist_init(flush_data_list, desc, 0); + ink_atomiclist_init(flush_data_list, "Logging flush buffer list", 0); Continuation *flush_cont = new LoggingFlushContinuation(0); - sprintf(desc, "[LOG_FLUSH]"); - eventProcessor.spawn_thread(flush_cont, desc, stacksize); + eventProcessor.spawn_thread(flush_cont, "[LOG_FLUSH]", stacksize); } /*-------------------------------------------------------------------------