]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: config checks alstate before getting tx
authorPhilippe Antoine <contact@catenacyber.fr>
Fri, 8 Apr 2022 13:15:23 +0000 (15:15 +0200)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 21 Apr 2022 07:31:56 +0000 (13:01 +0530)
Ticket: 4972

As is done in detect-lua-extensions.
We can have a flow with alproto unknown, no state, and therefore
cannot run AppLayerParserGetTx which could try to run a NULL
function

(cherry picked from commit dccf2e4c30b968477d9cc7e7a86b64b97893831c)

src/detect-config.c

index c7d63a66412d5c61bdc1ab2552857b97866a0fe5..7988314e7d1bbed77b3bf6ab5624270196dcbd98 100644 (file)
@@ -89,6 +89,9 @@ void DetectConfigRegister(void)
 static void ConfigApplyTx(Flow *f,
         const uint64_t tx_id, const DetectConfigData *config)
 {
+    if (f->alstate == NULL) {
+        return;
+    }
     void *tx = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, tx_id);
     if (tx) {
         AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, tx);