summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-08-06 06:03:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-08-06 06:03:30 +0000
commit67670927c393e303c11ce506c568f31f9a27c699 (patch)
tree5f32328a874c2db5d8a82db5a40ba49167bb354c /service
parent8beb8e0b4537bc25291fa98e1406987973f75d8d (diff)
parent3a3fcdb97c6b0fc39391bce8365ff6807374df4c (diff)
Merge "WifiScoreCard: catch IllegalArgumentException when SSID > 32 bytes" into rvc-qpr-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiScoreCard.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiScoreCard.java b/service/java/com/android/server/wifi/WifiScoreCard.java
index 64da835f0..2ab5fb466 100644
--- a/service/java/com/android/server/wifi/WifiScoreCard.java
+++ b/service/java/com/android/server/wifi/WifiScoreCard.java
@@ -1689,11 +1689,18 @@ public class WifiScoreCard {
* @return
*/
public static long computeHashLong(String ssid, MacAddress mac, String l2KeySeed) {
+ final ArrayList<Byte> decodedSsid;
+ try {
+ decodedSsid = NativeUtil.decodeSsid(ssid);
+ } catch (IllegalArgumentException e) {
+ Log.e(TAG, "NativeUtil.decodeSsid failed: malformed string: " + ssid);
+ return 0;
+ }
byte[][] parts = {
// Our seed keeps the L2Keys specific to this device
l2KeySeed.getBytes(),
// ssid is either quoted utf8 or hex-encoded bytes; turn it into plain bytes.
- NativeUtil.byteArrayFromArrayList(NativeUtil.decodeSsid(ssid)),
+ NativeUtil.byteArrayFromArrayList(decodedSsid),
// And the BSSID
mac.toByteArray()
};