summaryrefslogtreecommitdiffstats
path: root/services/backup
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2014-08-07 20:57:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-07 15:00:45 +0000
commit0660244119243928a69e5f21ef5ea339c7f6d008 (patch)
tree903bb725d4767fcdd59737656f66433a62d426e0 /services/backup
parentf9b4c2cc6ffbcb21f8e9b015ed3bdab0501bdf65 (diff)
parentcce476034388383a6006555a225e2170f3b4dcd9 (diff)
downloadframeworks_base-0660244119243928a69e5f21ef5ea339c7f6d008.zip
frameworks_base-0660244119243928a69e5f21ef5ea339c7f6d008.tar.gz
frameworks_base-0660244119243928a69e5f21ef5ea339c7f6d008.tar.bz2
Merge "Sanity-check paths of files to be restored" into lmp-dev
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 59aef32..77b14ac 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -5129,6 +5129,14 @@ public class BackupManagerService extends IBackupManager.Stub {
}
}
+ // The path needs to be canonical
+ if (info.path.contains("..") || info.path.contains("//")) {
+ if (MORE_DEBUG) {
+ Slog.w(TAG, "Dropping invalid path " + info.path);
+ }
+ return false;
+ }
+
// Otherwise we think this file is good to go
return true;
}
@@ -5680,6 +5688,14 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
break;
}
+ // The path needs to be canonical
+ if (info.path.contains("..") || info.path.contains("//")) {
+ if (MORE_DEBUG) {
+ Slog.w(TAG, "Dropping invalid path " + info.path);
+ }
+ okay = false;
+ }
+
// If the policy is satisfied, go ahead and set up to pipe the
// data to the agent.
if (DEBUG && okay && mAgent != null) {