You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/06/15 16:55:54 UTC
[tomcat] branch master updated: Fix canonicalization of IPv6
addresses ending in "::"
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 59136a3 Fix canonicalization of IPv6 addresses ending in "::"
59136a3 is described below
commit 59136a305f5c6da40f9a87b23269fc5c73777871
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jun 15 17:55:38 2020 +0100
Fix canonicalization of IPv6 addresses ending in "::"
Based on a patch by syarramsetty-skyhook
---
java/org/apache/tomcat/util/net/IPv6Utils.java | 2 +-
test/org/apache/tomcat/util/net/TestIPv6Utils.java | 3 +++
webapps/docs/changelog.xml | 5 +++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/net/IPv6Utils.java b/java/org/apache/tomcat/util/net/IPv6Utils.java
index 94b8c49..bccc0a2 100644
--- a/java/org/apache/tomcat/util/net/IPv6Utils.java
+++ b/java/org/apache/tomcat/util/net/IPv6Utils.java
@@ -109,7 +109,7 @@ public class IPv6Utils {
int length = ipv6AddressLength;
int change = 0;
- if (colonsPos >= 0 && colonsPos < ipv6AddressLength - 2) {
+ if (colonsPos >= 0 && colonsPos < ipv6AddressLength - 1) {
int colonCounter = 0;
for (int i = 0; i < ipv6AddressLength; i++) {
if (ipv6Address.charAt(i) == ':') {
diff --git a/test/org/apache/tomcat/util/net/TestIPv6Utils.java b/test/org/apache/tomcat/util/net/TestIPv6Utils.java
index a220dd7..5d667ed 100644
--- a/test/org/apache/tomcat/util/net/TestIPv6Utils.java
+++ b/test/org/apache/tomcat/util/net/TestIPv6Utils.java
@@ -111,6 +111,9 @@ public class TestIPv6Utils {
Assert.assertEquals("2001:0:0:1::1", IPv6Utils.canonize("2001:0:0:1:0:0:0:1"));
Assert.assertEquals("2001:db8::1:0:0:1", IPv6Utils.canonize("2001:db8:0:0:1:0:0:1"));
+ // Already ends with "::"
+ Assert.assertEquals("2001:db8::", IPv6Utils.canonize("2001:db8::"));
+
// IPv4 inside IPv6
Assert.assertEquals("::ffff:192.0.2.1", IPv6Utils.canonize("::ffff:192.0.2.1"));
Assert.assertEquals("::ffff:192.0.2.1", IPv6Utils.canonize("0:0:0:0:0:ffff:192.0.2.1"));
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5d691af..ee341c2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -83,6 +83,11 @@
comma as a separater between cookies when using the RFC 6265 cookie
processor. Based on a patch by W J Carpenter. (markt)
</fix>
+ <fix>
+ Fix the utility code that converted IPv6 addresses to a canonical form
+ to correctly handle input addresses that ended with a pair of colons.
+ Based on a patch by syarramsetty-skyhook. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org