From 60a28c6c4b992d1d3959484442a205d6ae2bd977 Mon Sep 17 00:00:00 2001 From: vandwalle Date: Thu, 8 May 2014 17:20:23 -0700 Subject: Don't crash when asked to enable an AP with a null SSID. WifiConfiguration can have been build by an app with a NULL SSID, or other null fields. We need to verify that at least that those fields are not NULL before using them. More specifically, don't crash when enabling an AP with a null SSID in setApConfiguration function. Bug: 14568953 Change-Id: I6b33ddf97789c0ee4b850d3ec0bccb08100c21d5 --- wifi/java/android/net/wifi/WifiConfiguration.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'wifi') diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index ce8c8b8..85b81d9 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -506,6 +506,12 @@ public class WifiConfiguration implements Parcelable { * @hide */ public boolean isValid() { + if (SSID == null) + return false; + + if (allowedKeyManagement == null) + return false; + if (allowedKeyManagement.cardinality() > 1) { if (allowedKeyManagement.cardinality() != 2) { return false; -- cgit v1.1