* Tunnels: Enforce max tunnel length of 8, catch an index error
http://forum.i2p/viewtopic.php?t=2561
This commit is contained in:
@ -224,6 +224,10 @@ class BuildHandler {
|
|||||||
for (int i = 0; i < cfg.getLength(); i++) {
|
for (int i = 0; i < cfg.getLength(); i++) {
|
||||||
Hash peer = cfg.getPeer(i);
|
Hash peer = cfg.getPeer(i);
|
||||||
int record = order.indexOf(new Integer(i));
|
int record = order.indexOf(new Integer(i));
|
||||||
|
if (record < 0) {
|
||||||
|
_log.error("Bad status index " + i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int howBad = statuses[record];
|
int howBad = statuses[record];
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info(msg.getUniqueId() + ": Peer " + peer.toBase64() + " replied with status " + howBad);
|
_log.info(msg.getUniqueId() + ": Peer " + peer.toBase64() + " replied with status " + howBad);
|
||||||
|
@ -43,9 +43,11 @@ public abstract class TunnelPeerSelector {
|
|||||||
else
|
else
|
||||||
length -= off;
|
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) ||
|
if ( (ctx.tunnelManager().getOutboundTunnelCount() <= 0) ||
|
||||||
(ctx.tunnelManager().getFreeTunnelCount() <= 0) ) {
|
(ctx.tunnelManager().getFreeTunnelCount() <= 0) ) {
|
||||||
|
Reference in New Issue
Block a user