]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3401: main: update analyzer command log message to copy the variable...
authorRon Dempster (rdempste) <rdempste@cisco.com>
Fri, 29 Apr 2022 19:40:06 +0000 (19:40 +0000)
committerRon Dempster (rdempste) <rdempste@cisco.com>
Fri, 29 Apr 2022 19:40:06 +0000 (19:40 +0000)
Merge in SNORT/snort3 from ~RDEMPSTE/snort3:va_list to master

Squashed commit of the following:

commit 97b88140885310f3b48bde24cc3770eb73ab68c5
Author: Ron Dempster (rdempste) <rdempste@cisco.com>
Date:   Fri Apr 29 10:22:19 2022 -0400

    main: update analyzer command log message to copy the variable arguments before using them for the remote response

src/main/analyzer_command.cc

index 2b9c48241e530bd0918a823df5afe07450410237..2f192e5dd6091483fce0fc7bb0dbaf46ad359c2a 100644 (file)
@@ -44,9 +44,14 @@ using namespace snort;
 
 void AnalyzerCommand::log_message(ControlConn* ctrlcon, const char* format, va_list& ap)
 {
-    LogMessage(format, ap);
     if (ctrlcon && !ctrlcon->is_local())
-        ctrlcon->respond(format, ap);
+    {
+        va_list rap;
+        va_copy(rap, ap);
+        ctrlcon->respond(format, rap);
+        va_end(rap);
+    }
+    LogMessage(format, ap);
 }
 
 void AnalyzerCommand::log_message(ControlConn* ctrlcon, const char* format, ...)