]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4080: Taking care of few coverity warnings post porting of SMB Multichannel
authorSumit Kumar (sumikum7) <sumikum7@cisco.com>
Mon, 30 Oct 2023 07:02:59 +0000 (07:02 +0000)
committerBhargava Jandhyala (bjandhya) <bjandhya@cisco.com>
Mon, 30 Oct 2023 07:02:59 +0000 (07:02 +0000)
Merge in SNORT/snort3 from ~SUMIKUM7/snort3:post_porting_760 to master

Squashed commit of the following:

commit 896ce9cb02a539af2297c5bc4207a4879319e844
Author: Sumit Kumar <sumikum7@cisco.com>
Date:   Sat Oct 28 10:25:35 2023 +0530

    snort3_coverity: coverity errors and cppcheck warnings being fixed here

src/detection/fp_detect.cc
src/detection/rules.cc
src/main/snort_config.cc
src/service_inspectors/dce_rpc/ips_dce_iface.cc

index 694a85a5b3dde34c52b923e10c54c928af593edb..b7585165429ae743395547744a772dd279208e7a 100644 (file)
@@ -819,7 +819,7 @@ void MpseStash::process(IpsContext* context, MatchStore& store)
     unsigned i = 0;
 #endif
 
-    for ( auto it : store )
+    for ( const auto & it : store )
     {
         debug_logf(detection_trace, TRACE_RULE_EVAL,
             static_cast<snort::IpsContext*>(context)->packet, "Processing pattern match #%d\n", ++i);
index 7473f802a09a06243eb6f769f06eac9cb75774e4..8b6b593cc41cf0b8af24d5035f54b9558f4bbcb7 100644 (file)
@@ -60,7 +60,7 @@ bool operator< (const RuleKey& lhs, const RuleKey& rhs)
 
 void RuleStateMap::apply(SnortConfig* sc)
 {
-    for ( auto it : map )
+    for ( const auto & it : map )
     {
         const RuleKey& k = it.first;
         OptTreeNode* otn = OtnLookup(sc->otn_map, k.gid, k.sid);
index 1356653226a120fcb9ce4b9bd582dbb8dd959434..accee009c852108e3c3b47068aab4857b93057a3 100644 (file)
@@ -233,10 +233,10 @@ SnortConfig::~SnortConfig()
         return;
     }
 
-    for ( auto ct : classifications )
+    for ( const auto & ct : classifications )
         delete ct.second;
 
-    for ( auto rs : references )
+    for ( const auto & rs : references )
         delete rs.second;
 
     for ( auto* s : scratchers )
index cf891dc8392bfbb2f4323f7d96a0058c0f2aebc9..c12a9c0606995c36baa124077e162a3b3983d2ca 100644 (file)
@@ -464,9 +464,9 @@ public:
     { return DETECT; }
 
 public:
-    RangeCheck version;
-    bool any_frag;
-    Uuid uuid;
+    RangeCheck version = {};
+    bool any_frag = false;
+    Uuid uuid = {};
 };
 
 bool Dce2IfaceModule::begin(const char*, int, SnortConfig*)