* IRC Server: Fix IOOBE (ticket #559)

This commit is contained in:
zzz
2011-11-30 23:16:29 +00:00
parent 5fd20fc77c
commit f6cff78528
2 changed files with 12 additions and 15 deletions

View File

@@ -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)) {

View File

@@ -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));
}
/*************************************************************************