From cfc17d59b4b90ca40a07e2efe4dd7da4d32bf2c1 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 12 Mar 2011 16:08:52 +0000 Subject: [PATCH] * BuildHandler: Loop double-check --- .../src/net/i2p/router/tunnel/pool/BuildHandler.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java index afdd0600be..d604c1bf30 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java @@ -418,9 +418,19 @@ class BuildHandler { if ((!isOutEnd) && _context.routerHash().equals(nextPeer)) { // We are 2 hops in a row? Drop it without a reply. // No way to recognize if we are every other hop, but see below - _log.error("Dropping build request where we are in two consecutive hops"); + _log.error("Dropping build request, we the next hop"); return; } + // previous test should be sufficient to keep it from getting here but maybe not? + if (!isInGW) { + Hash from = state.fromHash; + if (from == null) + from = state.from.calculateHash(); + if (_context.routerHash().equals(from)) { + _log.error("Dropping build request, we are the previous hop"); + return; + } + } if ((!isOutEnd) && (!isInGW)) { Hash from = state.fromHash; if (from == null)