From c6c2ee94a70fd8a29c9f0a89a0a9ea32bede4cab Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 3 Mar 2021 06:15:26 -0500 Subject: [PATCH] SSU: Fix NPE in introduction manager (move ip length check after isValid() null check) --- .../net/i2p/router/transport/udp/IntroductionManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java index cdbd7e56b..13d2e832e 100644 --- a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java +++ b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java @@ -225,16 +225,16 @@ class IntroductionManager { } int oldFound = found; for (RouterAddress ra : ras) { - // IPv6 allowed as of 0.9.50 byte[] ip = ra.getIP(); + int port = ra.getPort(); + if (!isValid(ip, port, true)) + continue; + // IPv6 allowed as of 0.9.50 if (ip.length == 16 && VersionComparator.comp(ri.getVersion(), MIN_IPV6_INTRODUCER_VERSION) < 0) { if (_log.shouldLog(Log.INFO)) _log.info("Would have picked IPv6 introducer but he doesn't support it: " + cur); continue; } - int port = ra.getPort(); - if (!isValid(ip, port, true)) - continue; cur.setIntroducerTime(); UDPAddress ura = new UDPAddress(ra); byte[] ikey = ura.getIntroKey();