* Tunnels: Enforce max tunnel length of 8, catch an index error

http://forum.i2p/viewtopic.php?t=2561
This commit is contained in:
zzz
2008-02-19 15:28:41 +00:00
parent bc16078e3f
commit 918b1acb8f
2 changed files with 8 additions and 2 deletions

View File

@ -224,6 +224,10 @@ class BuildHandler {
for (int i = 0; i < cfg.getLength(); i++) {
Hash peer = cfg.getPeer(i);
int record = order.indexOf(new Integer(i));
if (record < 0) {
_log.error("Bad status index " + i);
return;
}
int howBad = statuses[record];
if (_log.shouldLog(Log.INFO))
_log.info(msg.getUniqueId() + ": Peer " + peer.toBase64() + " replied with status " + howBad);

View File

@ -43,9 +43,11 @@ public abstract class TunnelPeerSelector {
else
length -= off;
}
if (length < 0)
length = 0;
}
if (length < 0)
length = 0;
if (length > 8) // as documented in tunnel.html
length = 8;
/*
if ( (ctx.tunnelManager().getOutboundTunnelCount() <= 0) ||
(ctx.tunnelManager().getFreeTunnelCount() <= 0) ) {