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.
This commit is contained in:
Mark Taylor 2016-02-10 12:50:30 -05:00
parent ba8742ebb4
commit 2ae80640cb

View file

@ -112,16 +112,16 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
return; return;
unsigned int pos = myline.find(' '); unsigned int pos = myline.find(' ');
// Not all commands require parameters
if ( pos > (unsigned int) length ) if ( pos > (unsigned int) length )
{ pos = (unsigned int) length;
Weird("irc_invalid_line");
return;
}
command = myline.substr(0, pos); command = myline.substr(0, pos);
for ( unsigned int i = 0; i < command.size(); ++i ) for ( unsigned int i = 0; i < command.size(); ++i )
command[i] = toupper(command[i]); command[i] = toupper(command[i]);
// Adjust for the no-parameter case
if ( pos == (unsigned int) length )
pos--;
myline = myline.substr(pos + 1); myline = myline.substr(pos + 1);
} }