From: Yehor Velykozhon -X (yvelykoz - SOFTSERVE INC at Cisco) Date: Fri, 9 Aug 2024 13:24:17 +0000 (+0000) Subject: Pull request #4377: src: resolve various warnings X-Git-Tag: 3.3.3.0~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=889c7bd6ac9e5782213acf02c2a0faee06d0f648;p=thirdparty%2Fsnort3.git Pull request #4377: src: resolve various warnings Merge in SNORT/snort3 from ~YVELYKOZ/snort3:thresholds_upd to master Squashed commit of the following: commit 6afa4c2bf6b546377f049574704faaa7b10167aa Author: Yehor Velykozhon Date: Thu Jul 4 17:35:06 2024 +0300 src: resolve various warnings --- diff --git a/daqs/daq_hext.c b/daqs/daq_hext.c index e7b602042..7b5e70424 100644 --- a/daqs/daq_hext.c +++ b/daqs/daq_hext.c @@ -25,6 +25,7 @@ #include "daq_user.h" #include +#include #include #include #include @@ -373,7 +374,10 @@ static void parse_string(HextContext* hc, char* s, HextMsgDesc *desc) while (*s && *s != '"' && desc->msg.data_len < hc->snaplen) { if (unescape(*s++, &t)) + { + assert(desc->data); desc->data[desc->msg.data_len++] = t; + } } desc->pkthdr.pktlen = desc->msg.data_len; } diff --git a/src/detection/fp_config.h b/src/detection/fp_config.h index 382e2db2c..31b13fab0 100644 --- a/src/detection/fp_config.h +++ b/src/detection/fp_config.h @@ -148,7 +148,6 @@ private: bool inspect_stream_insert = true; bool split_any_any = false; - bool debug_print_fast_pattern = false; bool debug = false; bool dedup = true; diff --git a/src/search_engines/bnfa_search.cc b/src/search_engines/bnfa_search.cc index 8047ca9ea..54d9443c7 100644 --- a/src/search_engines/bnfa_search.cc +++ b/src/search_engines/bnfa_search.cc @@ -840,7 +840,7 @@ static int _bnfa_conv_list_to_csparse_array(bnfa_struct_t* bnfa) bnfa_state_t* pi; /* state indexes into ps */ bnfa_state_t ps_index=0; unsigned nps; - bnfa_state_t full[BNFA_MAX_ALPHABET_SIZE]; + bnfa_state_t full[BNFA_MAX_ALPHABET_SIZE] = {}; /* count total state transitions, account for state and control words */ nps = 0; diff --git a/src/stream/tcp/tcp_trace.cc b/src/stream/tcp/tcp_trace.cc index e53023cbc..4c58d7e6d 100644 --- a/src/stream/tcp/tcp_trace.cc +++ b/src/stream/tcp/tcp_trace.cc @@ -89,15 +89,14 @@ inline void TraceSession(const snort::Flow* flow, const snort::Packet* p) inline void TraceSegments(const TcpReassemblySegments& seglist, const snort::Packet* p) { + if ( !trace_enabled(stream_tcp_trace, TRACE_SEGMENTS) ) + return; + const TcpSegmentNode* tsn = seglist.head; uint32_t sx = seglist.tracker->r_win_base; unsigned segs = 0; - unsigned bytes = 0; std::stringstream ss; - if ( !trace_enabled(stream_tcp_trace, TRACE_SEGMENTS) ) - return; - while ( tsn ) { uint32_t seq = tsn->start_seq(); @@ -112,17 +111,14 @@ inline void TraceSegments(const TcpReassemblySegments& seglist, const snort::Pac if ( tsn->cursor and tsn->unscanned() > 0 ) ss << "(" << tsn->cursor << "|" << tsn->unscanned() << ")"; + segs++; - bytes += tsn->length; sx = seq + tsn->length; tsn = tsn->next; } if ( !ss.str().empty() ) trace_logf(DEFAULT_TRACE_LOG_LEVEL, stream_tcp_trace, TRACE_SEGMENTS, p, " %s\n", ss.str().c_str()); - - assert(seglist.seg_count == segs); - assert(seglist.seg_bytes_logical == bytes); } inline void TraceState(const TcpStreamTracker& a, const TcpStreamTracker& b, const char* s,