diff options
author | Michael W <baddaemon87@gmail.com> | 2016-12-23 21:59:41 +0100 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2016-12-30 03:09:41 +0000 |
commit | bacaf11977c5ef8d6ba7434ec03886e83ca738f9 (patch) | |
tree | 15278ac1ac85235eb9ed8ca4309b6312702d32ea | |
parent | 9395d02b1769419fd875143ced9ec7ae823b4c97 (diff) | |
download | frameworks_base-bacaf11977c5ef8d6ba7434ec03886e83ca738f9.zip frameworks_base-bacaf11977c5ef8d6ba7434ec03886e83ca738f9.tar.gz frameworks_base-bacaf11977c5ef8d6ba7434ec03886e83ca738f9.tar.bz2 |
Telephony: Don't crash for too long baseband version
Add a check and truncate the baseband version when it's longer than
the allowed value for a SystemProperty (currently 91)
Change-Id: I845b331650eb4446aa251e48d7594ecb10146d54
Reference: BugDumps 13-20161216-22 L#22
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 5ec6950..1f63a22 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4692,6 +4692,12 @@ public class TelephonyManager { if (SubscriptionManager.isValidPhoneId(phoneId)) { String prop = TelephonyProperties.PROPERTY_BASEBAND_VERSION + ((phoneId == 0) ? "" : Integer.toString(phoneId)); + if (version != null && version.length() > SystemProperties.PROP_VALUE_MAX) { + Log.e(TAG, "setBasebandVersionForPhone(): version string '" + version + + "' too long! (" + version.length() + + " > " + SystemProperties.PROP_VALUE_MAX + ")"); + version = version.substring(0, SystemProperties.PROP_VALUE_MAX); + } SystemProperties.set(prop, version); } } |