diff options
author | gary <gary@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-05 09:32:57 +0000 |
---|---|---|
committer | gary <gary@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-05 09:32:57 +0000 |
commit | b2f717e8d96740c7c18198f0befd6a87e2000aab (patch) | |
tree | ba7f76167114b1b65938637a4371a9ad32ae6163 /libjava | |
parent | 009860bf38b6743497139321025a5230ccc4dfdd (diff) | |
download | gcc-b2f717e8d96740c7c18198f0befd6a87e2000aab.tar.gz |
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
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/classpath/ChangeLog.gcj | 6 | ||||
-rw-r--r-- | libjava/classpath/java/net/SocketPermission.java | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index 91948d1fe92..56d1cb91144 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,3 +1,9 @@ +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> * native/jni/gconf-peer/Makefile.in: Rebuilt. diff --git a/libjava/classpath/java/net/SocketPermission.java b/libjava/classpath/java/net/SocketPermission.java index 2d6343dc570..64885438aed 100644 --- a/libjava/classpath/java/net/SocketPermission.java +++ b/libjava/classpath/java/net/SocketPermission.java @@ -193,16 +193,19 @@ public final class SocketPermission extends Permission implements Serializable if (hostport.charAt(0) == '[') return hostport; - int colons = 0, last_colon = 0; + int colons = 0; + boolean colon_allowed = true; for (int i = 0; i < hostport.length(); i++) { if (hostport.charAt(i) == ':') { - if (i - last_colon == 1) + if (!colon_allowed) throw new IllegalArgumentException("Ambiguous hostport part"); colons++; - last_colon = i; + colon_allowed = false; } + else + colon_allowed = true; } switch (colons) @@ -218,6 +221,7 @@ public final class SocketPermission extends Permission implements Serializable case 8: // an IPv6 address with ports + int last_colon = hostport.lastIndexOf(':'); return "[" + hostport.substring(0, last_colon) + "]" + hostport.substring(last_colon); |