]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output/tx: use dynamic number of app-layer protos
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 21 Jun 2024 17:32:32 +0000 (19:32 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 2 Jul 2024 09:52:38 +0000 (11:52 +0200)
OutputTxLoggerThreadData gets allocated after the number of app-layer
protos is definite

src/output-tx.c

index 671829fb75bf0e06e6cee1c16a0f020a254724dc..7bc569ef901607eb774578f61b4ccb7981756223 100644 (file)
 /** per thread data for this module, contains a list of per thread
  *  data for the packet loggers. */
 typedef struct OutputTxLoggerThreadData_ {
-    OutputLoggerThreadStore *store[ALPROTO_MAX];
-
     /* thread local data from file api */
     OutputFileLoggerThreadData *file;
     /* thread local data from filedata api */
     OutputFiledataLoggerThreadData *filedata;
+    OutputLoggerThreadStore *store[];
 } OutputTxLoggerThreadData;
 
 /* logger instance, a module + a output ctx,
@@ -542,7 +541,8 @@ end:
  *  loggers */
 static TmEcode OutputTxLogThreadInit(ThreadVars *tv, const void *_initdata, void **data)
 {
-    OutputTxLoggerThreadData *td = SCCalloc(1, sizeof(*td));
+    OutputTxLoggerThreadData *td =
+            SCCalloc(1, sizeof(*td) + ALPROTO_MAX * sizeof(OutputLoggerThreadStore *));
     if (td == NULL)
         return TM_ECODE_FAILED;