mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
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:
parent
ba8742ebb4
commit
2ae80640cb
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue