]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4898: actions: fix integer underflow in ips_actions pegcount aggregation
authorVitalii Tron -X (vtron - SOFTSERVE INC at Cisco) <vtron@cisco.com>
Fri, 19 Sep 2025 18:31:23 +0000 (18:31 +0000)
committerSteve Chew (stechew) <stechew@cisco.com>
Fri, 19 Sep 2025 18:31:23 +0000 (18:31 +0000)
Merge in SNORT/snort3 from ~VTRON/snort3:fix_action_counters_underflow to master

Squashed commit of the following:

commit 4f2076d35fb802e4abb2dc45e6f7fb2a9fbd1f70
Author: Vitalii Tron <vtron@cisco.com>
Date:   Tue Sep 9 12:37:02 2025 -0400

    actions: fix integer underflow in ips_actions pegcount aggregation

src/actions/actions_module.cc
src/actions/actions_module.h

index 38da6badc95b3763c15c2499b79c219b68b1a433..d7dd035a71a19367af59dba34321e9baa8bcd3f1 100644 (file)
@@ -127,3 +127,11 @@ const PegInfo* ActionsModule::get_pegs() const
     return (PegInfo*)&peg_info_array[0];
 }
 
+void ActionsModule::reset_stats()
+{
+    std::fill(std::begin(peg_count_array), std::end(peg_count_array), 0);
+    std::fill(std::begin(prev_peg_count_array), std::end(prev_peg_count_array), 0);
+
+    Module::reset_stats();
+}
+
index c3c50c0b0adf22c2711f7f7dc3f463d4b7669ae9..80c3a333bdb6637de8d7809d8de8d5a7fc8ee916 100644 (file)
@@ -51,6 +51,8 @@ public:
     bool is_aggregator() const override
     { return true; }
 
+    void reset_stats() override;
+
 private:
     static std::map<std::string, std::vector<PegInfo>> module_peg_info_map;
     static std::array<PegInfo, ACTIONS_ARRAY_SIZE> peg_info_array;