I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit f6cff785 authored by zzz's avatar zzz
Browse files

* IRC Server: Fix IOOBE (ticket #559)

parent 5fd20fc7
No related branches found
No related tags found
No related merge requests found
......@@ -198,15 +198,13 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
String field[]=s.split(" ",5);
String command;
int idx=0;
if(field[0].charAt(0)==':')
idx++;
try {
if (field[0].charAt(0) == ':')
idx++;
command = field[idx++].toUpperCase(Locale.US);
} catch (IndexOutOfBoundsException ioobe) {
// wtf, server sent borked command?
throw new IOException("Dropping defective message: index out of bounds while extracting command.");
throw new IOException("Dropping defective message: [" + s + ']');
}
if ("USER".equals(command)) {
......
......@@ -55,12 +55,13 @@ abstract class IRCFilter {
"CAP"
};
if(field[0].charAt(0)==':')
idx++;
try { command = field[idx++].toUpperCase(Locale.US); }
catch (IndexOutOfBoundsException ioobe) // wtf, server sent borked command?
{
try {
if (field[0].charAt(0) == ':')
idx++;
command = field[idx++].toUpperCase(Locale.US);
} catch (IndexOutOfBoundsException ioobe) {
// wtf, server sent borked command?
//_log.warn("Dropping defective message: index out of bounds while extracting command.");
return null;
}
......@@ -151,6 +152,7 @@ abstract class IRCFilter {
// Commands that regular users might use
"ADMIN",
"AWAY", // should be harmless
"CAP", // http://tools.ietf.org/html/draft-mitchell-irc-capabilities-01
"CYCLE",
"DCCALLOW",
"HELPME", "HELPOP", // helpop is what unrealircd uses by default
......@@ -226,12 +228,9 @@ abstract class IRCFilter {
"TEMPSHUN",
"UNDCCDENY",
"WALLOPS",
"ZLINE",
// http://tools.ietf.org/html/draft-mitchell-irc-capabilities-01
"CAP"
"ZLINE"
};
_allowedOutbound = new HashSet(64);
_allowedOutbound.addAll(Arrays.asList(allowedCommands));
_allowedOutbound = new HashSet(Arrays.asList(allowedCommands));
}
/*************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment