]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3611: actions: fix rewrite nullptr log crash
authorOleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Tue, 4 Oct 2022 17:41:54 +0000 (17:41 +0000)
committerOleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Tue, 4 Oct 2022 17:41:54 +0000 (17:41 +0000)
Merge in SNORT/snort3 from ~ASERBENI/snort3:act_crash to master

Squashed commit of the following:

commit 2d65237dbeb6cdd1239964fd856b036d3cabc9a7
Author: Andrii Serbeniuk <aserbeni@cisco.com>
Date:   Mon Oct 3 16:41:53 2022 +0300

    actions: fix action logging for suppressed events

src/actions/act_alert.cc
src/actions/act_block.cc
src/actions/act_drop.cc
src/actions/act_react.cc
src/actions/act_reject.cc
src/actions/actions.cc

index fbc9fe70594350e25c8788f6893408631c238c0b..9f95ea3e9ee1ee11b18444b5a2d9505334d7afe8 100644 (file)
@@ -45,8 +45,7 @@ public:
 
 void AlertAction::exec(Packet* p, const OptTreeNode* otn)
 {
-    if ( otn )
-        Actions::alert(p, otn);
+    Actions::alert(p, otn);
 }
 
 //-------------------------------------------------------------------------
index 6dce6fad2601fc2274cf43b4fdd60d2d4a98937a..2cf749a4755e102e9291c8b1563a99700974a32f 100644 (file)
@@ -49,8 +49,8 @@ void BlockAction::exec(Packet* p, const OptTreeNode* otn)
 {
     p->active->block_session(p);
     p->active->set_drop_reason("ips");
-    if ( otn )
-        Actions::alert(p, otn);
+
+    Actions::alert(p, otn);
 }
 
 //-------------------------------------------------------------------------
index 0df4ac6917c2748764d1a6cc32778f12e16e51d6..e65f9eab3cc086aaa50948b985455baa35bc2075 100644 (file)
@@ -49,8 +49,8 @@ void DropAction::exec(Packet* p, const OptTreeNode* otn)
 {
     p->active->drop_packet(p);
     p->active->set_drop_reason("ips");
-    if ( otn )
-        Actions::alert(p, otn);
+
+    Actions::alert(p, otn);
 }
 
 //-------------------------------------------------------------------------
index 4ea94e633220484fb59b0548e6a0690321d48784..cdb80f20f7c86406d438de4df623428aa0b90560 100644 (file)
@@ -209,8 +209,8 @@ void ReactAction::exec(Packet* p, const OptTreeNode* otn)
 {
     p->active->drop_packet(p);
     p->active->set_drop_reason("ips");
-    if ( otn )
-        Actions::alert(p, otn);
+
+    Actions::alert(p, otn);
 }
 
 //-------------------------------------------------------------------------
index 6e1f78873436ca4ff2f61dca63eeffa6c90aaae8..a07c1d55d4034f763a23ce85d57fc9a6ce923765 100644 (file)
@@ -175,8 +175,7 @@ void RejectAction::exec(Packet* p, const OptTreeNode* otn)
     p->active->reset_again();
     p->active->update_status(p);
 
-    if ( otn )
-        Actions::alert(p, otn);
+    Actions::alert(p, otn);
 }
 
 //-------------------------------------------------------------------------
index 87b74e583e2092c72c546c4dcc12c9adc705d714..7fc35408c2ad4f9e91210cf7858b6ca19c69eb5c 100644 (file)
@@ -45,6 +45,9 @@ void Actions::log(Packet* p, const OptTreeNode* otn)
 
 void Actions::alert(Packet* p, const OptTreeNode* otn)
 {
+    if (!otn)
+        return;
+
     RuleTreeNode* rtn = getRtnFromOtn(otn);
     assert(rtn);