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

Commit 2400d27a authored by Ritesh Reddy's avatar Ritesh Reddy
Browse files

Constrained allowable backup versions

Constrained the version on an incoming backup set
to the highest version that the SettingsBackupAgent
can handle. This is to deal with either corrupted backup
sets or newer backup sets (when modifiying/downgrading the
SettingsBackupAgent).

Change-Id: I4d666e8d4541c0b86e656a73744837d03318c4ae
parent fe13c5fb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -730,6 +730,11 @@ public class SettingsBackupAgent extends BackupAgentHelper {

        try {
            int stateVersion = dataInput.readInt();
            if (stateVersion > STATE_VERSION) {
                // Constrain the maximum state version this backup agent
                // can handle in case a newer or corrupt backup set existed
                stateVersion = STATE_VERSION;
            }
            for (int i = 0; i < STATE_SIZES[stateVersion]; i++) {
                stateChecksums[i] = dataInput.readLong();
            }