From: Sumit Kumar (sumikum7) Date: Mon, 30 Oct 2023 07:02:59 +0000 (+0000) Subject: Pull request #4080: Taking care of few coverity warnings post porting of SMB Multichannel X-Git-Tag: 3.1.74.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b7f1d422378f424d2fba4d7c20943956e07dcb3;p=thirdparty%2Fsnort3.git Pull request #4080: Taking care of few coverity warnings post porting of SMB Multichannel Merge in SNORT/snort3 from ~SUMIKUM7/snort3:post_porting_760 to master Squashed commit of the following: commit 896ce9cb02a539af2297c5bc4207a4879319e844 Author: Sumit Kumar Date: Sat Oct 28 10:25:35 2023 +0530 snort3_coverity: coverity errors and cppcheck warnings being fixed here --- diff --git a/src/detection/fp_detect.cc b/src/detection/fp_detect.cc index 694a85a5b..b75851654 100644 --- a/src/detection/fp_detect.cc +++ b/src/detection/fp_detect.cc @@ -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(context)->packet, "Processing pattern match #%d\n", ++i); diff --git a/src/detection/rules.cc b/src/detection/rules.cc index 7473f802a..8b6b593cc 100644 --- a/src/detection/rules.cc +++ b/src/detection/rules.cc @@ -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); diff --git a/src/main/snort_config.cc b/src/main/snort_config.cc index 135665322..accee009c 100644 --- a/src/main/snort_config.cc +++ b/src/main/snort_config.cc @@ -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 ) diff --git a/src/service_inspectors/dce_rpc/ips_dce_iface.cc b/src/service_inspectors/dce_rpc/ips_dce_iface.cc index cf891dc83..c12a9c060 100644 --- a/src/service_inspectors/dce_rpc/ips_dce_iface.cc +++ b/src/service_inspectors/dce_rpc/ips_dce_iface.cc @@ -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*)