diff --git a/CHANGES b/CHANGES index 5aeeff15b1..b97722b141 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +6.2.0-dev.461 | 2024-01-24 23:04:12 +0100 + + * HTTP: Coverity std::move suggestion (Arne Welzel, Corelight) + + * WebSocket: Coverity std::move suggestion (Arne Welzel, Corelight) + + * SMTP/BDAT: Fix SonarQube reported issues (Arne Welzel, Corelight) + 6.2.0-dev.456 | 2024-01-23 21:53:07 +0100 * btest/smtp/bdat: Move tests into proper directory (Arne Welzel, Corelight) diff --git a/VERSION b/VERSION index 494fa0ecff..dd406e1806 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.2.0-dev.456 +6.2.0-dev.461 diff --git a/src/analyzer/protocol/http/HTTP.cc b/src/analyzer/protocol/http/HTTP.cc index e9c0ff4a2d..5cef7d79c7 100644 --- a/src/analyzer/protocol/http/HTTP.cc +++ b/src/analyzer/protocol/http/HTTP.cc @@ -1371,7 +1371,7 @@ void HTTP_Analyzer::HTTP_Upgrade() { analyzer_tag_val->GetType()->Lookup(analyzer_tag_val->AsEnum()), upgrade_protocol_val->CheckString()); auto analyzer_tag = analyzer_mgr->GetComponentTag(analyzer_tag_val.get()); - auto* analyzer = analyzer_mgr->InstantiateAnalyzer(analyzer_tag, Conn()); + auto* analyzer = analyzer_mgr->InstantiateAnalyzer(std::move(analyzer_tag), Conn()); if ( analyzer ) { AddChildAnalyzer(analyzer); diff --git a/src/analyzer/protocol/smtp/BDAT.cc b/src/analyzer/protocol/smtp/BDAT.cc index bd1f8fadf1..630dfe9cbe 100644 --- a/src/analyzer/protocol/smtp/BDAT.cc +++ b/src/analyzer/protocol/smtp/BDAT.cc @@ -104,13 +104,13 @@ void SMTP_BDAT_Analyzer::DeliverStream(int len, const u_char* data, bool is_orig } } - // Start searching for crlf at the end of the old buffer. - std::string::size_type i = buf.size() - 1; + // Start searching for crlf at the end of the old buffer, if any. + std::string::size_type i = buf.size() > 0 ? buf.size() - 1 : 0; buf.append(reinterpret_cast(data), len); std::string::size_type line_start = 0; - for ( i = 0; i < buf.size(); i++ ) { + for ( ; i < buf.size(); i++ ) { if ( i < buf.size() - 1 && buf[i] == '\r' && buf[i + 1] == '\n' ) { // Found a match, buf[line_start, i) is the line we want to Deliver() buf[i] = '\0'; @@ -314,10 +314,9 @@ public: void SubmitAllHeaders(mime::MIME_HeaderList& hlist) override {} void SubmitData(int len, const char* buf) override {} bool RequestBuffer(int* plen, char** pbuf) override { return false; } - void SubmitAllData() {} void SubmitEvent(int event_type, const char* detail) override {} - const auto& DeliverCalls() { return deliver_calls; } + const auto& DeliverCalls() const { return deliver_calls; } private: std::vector> deliver_calls; diff --git a/src/analyzer/protocol/websocket/websocket-analyzer.pac b/src/analyzer/protocol/websocket/websocket-analyzer.pac index fc60538161..a1d9c30b18 100644 --- a/src/analyzer/protocol/websocket/websocket-analyzer.pac +++ b/src/analyzer/protocol/websocket/websocket-analyzer.pac @@ -85,7 +85,7 @@ refine flow WebSocket_Flow += { zeek::BifEvent::enqueue_websocket_frame_data(connection()->zeek_analyzer(), connection()->zeek_analyzer()->Conn(), is_orig(), - data_val); + std::move(data_val)); } // Forward text and binary data to downstream analyzers.