summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-04-16 14:39:07 +0100
committerCalin Juravle <calin@google.com>2014-04-24 11:25:04 +0100
commit232c91dce1760b180155256d1896d0d80375ff6d (patch)
treea915b0b0eaf79e3640357ad39c6819e899e6f2f8
parent91916bf7febac5618c5bc8d1773910a4314c0b4b (diff)
downloadlibcore-232c91dce1760b180155256d1896d0d80375ff6d.zip
libcore-232c91dce1760b180155256d1896d0d80375ff6d.tar.gz
libcore-232c91dce1760b180155256d1896d0d80375ff6d.tar.bz2
Disallow explicit signs in SocketHandler port parsing.
Bug: 5239391 Change-Id: Ifa6bc6b352c283e8f6913b4905a9541df7355915
-rw-r--r--luni/src/main/java/java/util/logging/SocketHandler.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/luni/src/main/java/java/util/logging/SocketHandler.java b/luni/src/main/java/java/util/logging/SocketHandler.java
index 85a9e6c..48bfc0e 100644
--- a/luni/src/main/java/java/util/logging/SocketHandler.java
+++ b/luni/src/main/java/java/util/logging/SocketHandler.java
@@ -108,12 +108,9 @@ public class SocketHandler extends StreamHandler {
// check the validity of the port number
int p = 0;
try {
- p = Integer.parseInt(port);
+ p = Integer.parsePositiveInt(port);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Illegal port argument");
- }
- if (p <= 0) {
- throw new IllegalArgumentException("Illegal port argument");
+ throw new IllegalArgumentException("Illegal port argument " + port);
}
// establish the network connection
try {