Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bacaf119 authored by Michael W's avatar Michael W Committed by Ethan Chen
Browse files

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
parent 9395d02b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }