diff options
author | Vinit Deshapnde <vinitd@google.com> | 2013-08-15 10:50:18 -0700 |
---|---|---|
committer | Vinit Deshapnde <vinitd@google.com> | 2013-08-15 10:50:18 -0700 |
commit | dda5a7152fd6e5933503aba8e8badbbba0631839 (patch) | |
tree | 8a362f8ee39150f571460da4f32322cabfec01b0 | |
parent | 2241d45c68739e5bdf187ba3325ee237ef143e21 (diff) | |
download | frameworks_base-dda5a7152fd6e5933503aba8e8badbbba0631839.zip frameworks_base-dda5a7152fd6e5933503aba8e8badbbba0631839.tar.gz frameworks_base-dda5a7152fd6e5933503aba8e8badbbba0631839.tar.bz2 |
Fix an exception caused by incorrect data handling
The prefixes in WifiEnterpriseConfig are optional, and should be treated
as such. If the prefix doesn't exist, it is possible for an
exception to be thrown (if the value size is smaller than prefix size).
Bug: 10304089
Change-Id: Id9b2bc0e371c818e35a5aa1913ee1697f167e19e
-rw-r--r-- | wifi/java/android/net/wifi/WifiEnterpriseConfig.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index 4bee937..e357804 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -721,7 +721,13 @@ public class WifiEnterpriseConfig implements Parcelable { String value = mFields.get(key); // Uninitialized or known to be empty after reading from supplicant if (TextUtils.isEmpty(value) || EMPTY_VALUE.equals(value)) return ""; - return removeDoubleQuotes(value).substring(prefix.length()); + + value = removeDoubleQuotes(value); + if (value.startsWith(prefix)) { + return value.substring(prefix.length()); + } else { + return value; + } } /** Set a value with an optional prefix at key |