aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-07 01:49:03 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-07 01:49:03 +0000
commit813397f7f94f9b3e5904442e3943fa8f99942acc (patch)
tree74f867000bec44d77e0921af24691df65d687f65
parent1db169ef47905408d060503e35e4aea889261f9b (diff)
parent6e8945a569d914f818c854ace75d305552ea69ef (diff)
downloadadb-android12L-d2-s6-release.tar.gz
Change-Id: I6fa41b923a2f5c435903410b409a7b633af999e0
-rw-r--r--client/file_sync_client.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/file_sync_client.cpp b/client/file_sync_client.cpp
index 2e8b9756..8f8601b9 100644
--- a/client/file_sync_client.cpp
+++ b/client/file_sync_client.cpp
@@ -544,7 +544,17 @@ class SyncConnection {
if (!ReadFdExactly(fd, buf, len)) return false;
buf[len] = 0;
-
+ // Address the unlikely scenario wherein a
+ // compromised device/service might be able to
+ // traverse across directories on the host. Let's
+ // shut that door!
+ if (strchr(buf, '/')
+#if defined(_WIN32)
+ || strchr(buf, '\\')
+#endif
+ ) {
+ return false;
+ }
callback(dent.mode, dent.size, dent.mtime, buf);
}
}