Skip to content
Snippets Groups Projects
Commit b2f717e8 authored by gary's avatar gary
Browse files

2006-10-05 Gary Benson <gbenson@redhat.com>

	* java/net/SocketPermission.java
	(processHostport): Cope with IPv6 addresses with a
	one-digit first component.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117454 138bc75d-0d04-0410-961f-82ee72b054a4
parent 009860bf
No related branches found
No related tags found
No related merge requests found
2006-10-05 Gary Benson <gbenson@redhat.com>
* java/net/SocketPermission.java
(processHostport): Cope with IPv6 addresses with a
one-digit first component.
2006-09-25 Tom Tromey <tromey@redhat.com> 2006-09-25 Tom Tromey <tromey@redhat.com>
* native/jni/gconf-peer/Makefile.in: Rebuilt. * native/jni/gconf-peer/Makefile.in: Rebuilt.
......
...@@ -193,16 +193,19 @@ public final class SocketPermission extends Permission implements Serializable ...@@ -193,16 +193,19 @@ public final class SocketPermission extends Permission implements Serializable
if (hostport.charAt(0) == '[') if (hostport.charAt(0) == '[')
return hostport; return hostport;
int colons = 0, last_colon = 0; int colons = 0;
boolean colon_allowed = true;
for (int i = 0; i < hostport.length(); i++) for (int i = 0; i < hostport.length(); i++)
{ {
if (hostport.charAt(i) == ':') if (hostport.charAt(i) == ':')
{ {
if (i - last_colon == 1) if (!colon_allowed)
throw new IllegalArgumentException("Ambiguous hostport part"); throw new IllegalArgumentException("Ambiguous hostport part");
colons++; colons++;
last_colon = i; colon_allowed = false;
} }
else
colon_allowed = true;
} }
switch (colons) switch (colons)
...@@ -218,6 +221,7 @@ public final class SocketPermission extends Permission implements Serializable ...@@ -218,6 +221,7 @@ public final class SocketPermission extends Permission implements Serializable
case 8: case 8:
// an IPv6 address with ports // an IPv6 address with ports
int last_colon = hostport.lastIndexOf(':');
return "[" + hostport.substring(0, last_colon) + "]" return "[" + hostport.substring(0, last_colon) + "]"
+ hostport.substring(last_colon); + hostport.substring(last_colon);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment