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

Commit 7425e8ae authored by fionaxu's avatar fionaxu Committed by android-build-merger
Browse files

backport security fix: avoid set NITZ time to 2038 am: 6c2365a2 am: 4c10b30d am: 2e7bd47d

am: a88ccfbb

Change-Id: I65ac1137c793d79987a8a54a33521cbc6c4f5912
parents a92fe9a1 a88ccfbb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    private static final int NITZ_UPDATE_DIFF_DEFAULT = 2000;
    private int mNitzUpdateDiff = SystemProperties.getInt("ro.nitz_update_diff",
            NITZ_UPDATE_DIFF_DEFAULT);
    /** Time stamp after 19 January 2038 is not supported under 32 bit */
    private static final int MAX_NITZ_YEAR = 2037;

    private int mRoamingIndicator;
    private boolean mIsInPrl;
@@ -1553,6 +1555,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            String[] nitzSubs = nitz.split("[/:,+-]");

            int year = 2000 + Integer.parseInt(nitzSubs[0]);
            if (year > MAX_NITZ_YEAR) {
              if (DBG) loge("NITZ year: " + year + " exceeds limit, skip NITZ time update");
              return;
            }
            c.set(Calendar.YEAR, year);

            // month is 0 based!
+6 −0
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {

    /** Boolean is true is setTimeFromNITZString was called */
    private boolean mNitzUpdatedTime = false;
    /** Time stamp after 19 January 2038 is not supported under 32 bit */
    private static final int MAX_NITZ_YEAR = 2037;

    String mSavedTimeZone;
    long mSavedTime;
@@ -1681,6 +1683,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            String[] nitzSubs = nitz.split("[/:,+-]");

            int year = 2000 + Integer.parseInt(nitzSubs[0]);
            if (year > MAX_NITZ_YEAR) {
              if (DBG) loge("NITZ year: " + year + " exceeds limit, skip NITZ time update");
              return;
            }
            c.set(Calendar.YEAR, year);

            // month is 0 based!