]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
analysis: exit if table entries are stale
authorJeff Lucovsky <jeff@lucovsky.org>
Sat, 4 Jan 2020 14:12:38 +0000 (09:12 -0500)
committerVictor Julien <victor@inliniac.net>
Mon, 20 Jan 2020 09:24:00 +0000 (10:24 +0100)
This commit causes Suricata to exit when a buffer from the analyzer
table is not recognized.

Since the table must match what's registered, exiting will bring noticed
to the condition.

src/detect-engine-analyzer.c

index 1f7acc92b798b0c9d0c9184ab7b208e600f62d66..1e1b510a7cb0794aec003085c6389e843fd4c4e0 100644 (file)
@@ -963,6 +963,12 @@ static void EngineAnalysisItemsInit(void)
         DetectEngineAnalyzerItems *analyzer_item = &analyzer_items[i];
 
         analyzer_item->item_id = DetectBufferTypeGetByName(analyzer_item->item_name);
+        if (analyzer_item->item_id == -1) {
+            /* Mismatch between the analyzer_items array and what's supported */
+            FatalError(SC_ERR_INITIALIZATION,
+                       "unable to initialize engine-analysis table: detect buffer \"%s\" not recognized.",
+                       analyzer_item->item_name);
+        }
         analyzer_item->item_seen = false;
 
         if (analyzer_item->export_item_seen) {