mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
SMTP/BDAT: Fix SonarQube reported issues
This commit is contained in:
parent
45000e2ec8
commit
b5b30eb58d
1 changed files with 4 additions and 5 deletions
|
@ -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.
|
// Start searching for crlf at the end of the old buffer, if any.
|
||||||
std::string::size_type i = buf.size() - 1;
|
std::string::size_type i = buf.size() > 0 ? buf.size() - 1 : 0;
|
||||||
|
|
||||||
buf.append(reinterpret_cast<const char*>(data), len);
|
buf.append(reinterpret_cast<const char*>(data), len);
|
||||||
|
|
||||||
std::string::size_type line_start = 0;
|
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' ) {
|
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()
|
// Found a match, buf[line_start, i) is the line we want to Deliver()
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
|
@ -314,10 +314,9 @@ public:
|
||||||
void SubmitAllHeaders(mime::MIME_HeaderList& hlist) override {}
|
void SubmitAllHeaders(mime::MIME_HeaderList& hlist) override {}
|
||||||
void SubmitData(int len, const char* buf) override {}
|
void SubmitData(int len, const char* buf) override {}
|
||||||
bool RequestBuffer(int* plen, char** pbuf) override { return false; }
|
bool RequestBuffer(int* plen, char** pbuf) override { return false; }
|
||||||
void SubmitAllData() {}
|
|
||||||
void SubmitEvent(int event_type, const char* detail) override {}
|
void SubmitEvent(int event_type, const char* detail) override {}
|
||||||
|
|
||||||
const auto& DeliverCalls() { return deliver_calls; }
|
const auto& DeliverCalls() const { return deliver_calls; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::pair<std::string, bool>> deliver_calls;
|
std::vector<std::pair<std::string, bool>> deliver_calls;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue