summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-06-28 11:39:42 -0700
committerRoshan Pius <rpius@google.com>2017-06-28 12:43:11 -0700
commit2940e4b1659db5d566b0c429f1b81d1d479bd708 (patch)
tree87500114a3aa269d409bd6f00989872130f42497
parentedec779524a0563580432fb2a7bb4cd75a6883ff (diff)
WifiConfigurationUtil: PSK hex string length should be 64
The length check was using an incorrect value of 128 in validatePsk(). Bug: 62987438 Test: Unit test Change-Id: I04c985946cec18cd07d40d35f22b3c14130abee2
-rw-r--r--service/java/com/android/server/wifi/WifiConfigurationUtil.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java3
2 files changed, 2 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
index a7a527b05..f706c4e1f 100644
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
@@ -54,7 +54,7 @@ public class WifiConfigurationUtil {
private static final int SSID_HEX_MAX_LEN = 64;
private static final int PSK_ASCII_MIN_LEN = 8 + ENCLOSING_QUTOES_LEN;
private static final int PSK_ASCII_MAX_LEN = 63 + ENCLOSING_QUTOES_LEN;
- private static final int PSK_HEX_LEN = 128;
+ private static final int PSK_HEX_LEN = 64;
@VisibleForTesting
public static final String PASSWORD_MASK = "*";
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
index cc3f7092a..376d686a4 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
@@ -217,8 +217,7 @@ public class WifiConfigurationUtilTest {
public void testValidatePositiveCases_Hex() {
WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
config.SSID = "abcd1234555a";
- config.preSharedKey = "abcd1234551512345567889900345566673323456673223445566767432334454"
- + "abcd12345515123455678899003455666733234566732234455667674323344";
+ config.preSharedKey = "abcd123455151234556788990034556667332345667322344556676743233445";
assertTrue(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
}