From 2ae80640cba1f1e89d5238fdbaeec0483536bac6 Mon Sep 17 00:00:00 2001 From: Mark Taylor Date: Wed, 10 Feb 2016 12:50:30 -0500 Subject: [PATCH] Allow IRC commands to not have parameters. When testing against irc-dcc-send.trace, I didn't see an irc_quit_message event generated for the QUIT command at the end of the trace, but rather a weird.log "irc_invalid_line" for the packet: the IRC packet parser wasn't allowing commands without parameters. --- src/analyzer/protocol/irc/IRC.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/analyzer/protocol/irc/IRC.cc b/src/analyzer/protocol/irc/IRC.cc index d1ee6dc468..d87e6f1762 100644 --- a/src/analyzer/protocol/irc/IRC.cc +++ b/src/analyzer/protocol/irc/IRC.cc @@ -112,16 +112,16 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) return; unsigned int pos = myline.find(' '); + // Not all commands require parameters if ( pos > (unsigned int) length ) - { - Weird("irc_invalid_line"); - return; - } - + pos = (unsigned int) length; command = myline.substr(0, pos); for ( unsigned int i = 0; i < command.size(); ++i ) command[i] = toupper(command[i]); + // Adjust for the no-parameter case + if ( pos == (unsigned int) length ) + pos--; myline = myline.substr(pos + 1); }