forked from I2P_Developers/i2p.i2p
SSU2: Fix uncaught IAE caused by itags with zero values (Gitlab #415)
This commit is contained in:
@ -515,8 +515,16 @@ class EstablishmentManager {
|
||||
} else if (version == 2) {
|
||||
boolean requestIntroduction = !isIndirect &&
|
||||
_transport.introducersMaybeRequired(TransportUtil.isIPv6(ra));
|
||||
state = new OutboundEstablishState2(_context, _transport, maybeTo, to,
|
||||
toIdentity, requestIntroduction, sessionKey, ra, addr);
|
||||
try {
|
||||
state = new OutboundEstablishState2(_context, _transport, maybeTo, to,
|
||||
toIdentity, requestIntroduction, sessionKey, ra, addr);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("OES2 error: " + toRouterInfo, iae);
|
||||
_transport.markUnreachable(toHash);
|
||||
_transport.failed(msg, iae.getMessage());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// shouldn't happen
|
||||
_transport.failed(msg, "OB to bad addr? " + ra);
|
||||
|
@ -196,7 +196,7 @@ class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payl
|
||||
_introducers.put(h, istate);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (claimedAddress != null) {
|
||||
_token = _transport.getEstablisher().getOutboundToken(_remoteHostId);
|
||||
if (_token != 0) {
|
||||
_currentState = OutboundState.OB_STATE_UNKNOWN;
|
||||
@ -205,6 +205,10 @@ class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payl
|
||||
_currentState = OutboundState.OB_STATE_NEEDS_TOKEN;
|
||||
}
|
||||
_introducers = null;
|
||||
} else {
|
||||
// i2pd bug fixed in 2.49.0/0.9.60, itag0-2 all zeros causes getIntroducerCount to be 0,
|
||||
// which gets us here
|
||||
throw new IllegalArgumentException("No address and no introducers for " + remotePeer.getHash());
|
||||
}
|
||||
|
||||
_sendConnID = ctx.random().nextLong();
|
||||
|
Reference in New Issue
Block a user