Fix/simplify some if statement comparisons

This commit is contained in:
Tim Wojtulewicz 2023-01-14 16:30:53 -07:00
parent 103b381874
commit 5bfd84a903
7 changed files with 13 additions and 12 deletions

View file

@ -436,7 +436,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
// Remove nick name.
parts.erase(parts.begin());
if ( parts.size() > 0 && parts[0][0] == ':' )
if ( parts[0][0] == ':' )
parts[0] = parts[0].substr(1);
auto set = make_intrusive<TableVal>(id::string_set);
@ -586,7 +586,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
// Check for DCC messages.
if ( message.size() > 3 && message.substr(0, 3) == "DCC" )
{
if ( message.size() > 0 && message[message.size() - 1] == 1 )
if ( message[message.size() - 1] == 1 )
message = message.substr(0, message.size() - 1);
vector<string> parts = SplitWords(message, ' ');

View file

@ -187,7 +187,7 @@ void NetbiosSSN_Interpreter::ParseMessageUDP(const u_char* data, int len, bool i
void NetbiosSSN_Interpreter::ParseSessionMsg(const u_char* data, int len, bool is_query)
{
if ( len < 4 || strncmp((const char*)data, "\xffSMB", 4) )
if ( len < 4 || strncmp((const char*)data, "\xffSMB", 4) != 0 )
{
// This should be an event, too.
analyzer->Weird("netbios_raw_session_msg");