From bacaf11977c5ef8d6ba7434ec03886e83ca738f9 Mon Sep 17 00:00:00 2001 From: Michael W Date: Fri, 23 Dec 2016 21:59:41 +0100 Subject: 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 --- telephony/java/android/telephony/TelephonyManager.java | 6 ++++++ 1 file changed, 6 insertions(+) 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); } } -- cgit v1.1