trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wka...@apache.org
Subject [trafficserver] branch master updated: Eliminate dangling pointer into stack space. (#7392)
Date Mon, 21 Dec 2020 17:25:09 GMT
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 95d1069  Eliminate dangling pointer into stack space. (#7392)
95d1069 is described below

commit 95d1069a9c5f70fe8b0fb57feec95e559ab92b91
Author: Walt Karas <wkaras@verizonmedia.com>
AuthorDate: Mon Dec 21 11:24:58 2020 -0600

    Eliminate dangling pointer into stack space. (#7392)
---
 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 d1806bc..cf6b04f 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 87e19e2..61307e0 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);
 }
 
 /*-------------------------------------------------------------------------


Mime
View raw message