diff options
author | Ningyuan Wang <nywang@google.com> | 2017-03-27 20:34:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-27 20:34:23 +0000 |
commit | 1ad9ac3a128506722a55ad784fb8c699d2e4b4ec (patch) | |
tree | 147b5cba4b55caa7109870758eb00070c85d7ef8 /service | |
parent | 7f7773b37d41371517f212ffdda3cca5b7181632 (diff) | |
parent | 8ce63761f263cc5190e87d6f5f8d0501e531168f (diff) |
Merge "Add try/catch blocks for incoming WificondControl params"
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WificondControl.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java index c88a80426..fdd0faffe 100644 --- a/service/java/com/android/server/wifi/WificondControl.java +++ b/service/java/com/android/server/wifi/WificondControl.java @@ -328,7 +328,17 @@ public class WificondControl { NativeScanResult[] nativeResults = mWificondScanner.getScanResults(); for (NativeScanResult result : nativeResults) { WifiSsid wifiSsid = WifiSsid.createFromByteArray(result.ssid); - String bssid = NativeUtil.macAddressFromByteArray(result.bssid); + String bssid; + try { + bssid = NativeUtil.macAddressFromByteArray(result.bssid); + } catch (IllegalArgumentException e) { + Log.e(TAG, "Illegal argument " + result.bssid, e); + continue; + } + if (bssid == null) { + Log.e(TAG, "Illegal null bssid"); + continue; + } ScanResult.InformationElement[] ies = InformationElementUtil.parseInformationElements(result.infoElement); InformationElementUtil.Capabilities capabilities = @@ -381,7 +391,12 @@ public class WificondControl { if (hiddenNetworkSSIDs != null) { for (String ssid : hiddenNetworkSSIDs) { HiddenNetwork network = new HiddenNetwork(); - network.ssid = NativeUtil.byteArrayFromArrayList(NativeUtil.decodeSsid(ssid)); + try { + network.ssid = NativeUtil.byteArrayFromArrayList(NativeUtil.decodeSsid(ssid)); + } catch (IllegalArgumentException e) { + Log.e(TAG, "Illegal argument " + ssid, e); + continue; + } settings.hiddenNetworks.add(network); } } @@ -414,8 +429,13 @@ public class WificondControl { PnoNetwork condNetwork = new PnoNetwork(); condNetwork.isHidden = (network.flags & WifiScanner.PnoSettings.PnoNetwork.FLAG_DIRECTED_SCAN) != 0; - condNetwork.ssid = - NativeUtil.byteArrayFromArrayList(NativeUtil.decodeSsid(network.ssid)); + try { + condNetwork.ssid = + NativeUtil.byteArrayFromArrayList(NativeUtil.decodeSsid(network.ssid)); + } catch (IllegalArgumentException e) { + Log.e(TAG, "Illegal argument " + network.ssid, e); + continue; + } settings.pnoNetworks.add(condNetwork); } } |