From 2fcee6e87ae64cbb7bbc810ff325a006fd4066c9 Mon Sep 17 00:00:00 2001 From: sponge Date: Thu, 15 Apr 2010 06:38:35 +0000 Subject: [PATCH] I2PTunnelHTTPClient: Test for "http://:/" and output error page. This avoids an ArrayIndexOutOfBoundsException, which can eventually cause the eepproxy to stop functioning. --- apps/BOB/nbproject/private/private.xml | 3 +++ .../net/i2p/i2ptunnel/I2PTunnelHTTPClient.java | 16 +++++++++++++--- history.txt | 5 +++++ .../java/src/net/i2p/router/RouterVersion.java | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/BOB/nbproject/private/private.xml b/apps/BOB/nbproject/private/private.xml index c1f155a782..683809948c 100644 --- a/apps/BOB/nbproject/private/private.xml +++ b/apps/BOB/nbproject/private/private.xml @@ -1,4 +1,7 @@ + + file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java + diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index 7f6759a5f1..488ba05352 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -366,7 +366,17 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable int port = 80; if(posPort != -1) { String[] parts = host.split(":"); + try { host = parts[0]; + } catch (ArrayIndexOutOfBoundsException ex) { + if (out != null) { + out.write(getErrorPage("denied", ERR_REQUEST_DENIED)); + writeFooter(out); + } + s.close(); + return; + + } try { port = Integer.parseInt(parts[1]); } catch(Exception exc) { @@ -437,9 +447,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable // Silently bypass correct keys, otherwise alert String destB64 = null; try { - Destination dest = I2PTunnel.destFromName(host); - if (dest != null) - destB64 = dest.toBase64(); + Destination _dest = I2PTunnel.destFromName(host); + if (_dest != null) + destB64 = _dest.toBase64(); } catch (DataFormatException dfe) {} if (destB64 != null && !destB64.equals(ahelperKey)) { diff --git a/history.txt b/history.txt index ac6f60dd69..8d242bd34e 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2010-04-15 sponge + * I2PTunnelHTTPClient: Test for "http://:/" and output error page. + This avoids an ArrayIndexOutOfBoundsException, which can eventually + cause the eepproxy to stop functioning. + 2010-04-12 zzz * configstats.jsp: Fix full stats checkbox default * i2psnark: diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index f2522cd4ed..7ca1a3ec2c 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 9; + public final static long BUILD = 10; /** for example "-test" */ public final static String EXTRA = "";