summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-20 02:54:08 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-20 02:54:08 +0000
commitcef637a4fb112f4b8cd8e53abcbedbaca226ea36 (patch)
tree62f65196e54f5f914f442679e23ff2113cd0b114
parentc53d859120c1ae3355533293ef72a2db341246ea (diff)
parent68e09aa4fe3bb2448b560c30d3dc33e0982013a7 (diff)
downloadcore-cef637a4fb112f4b8cd8e53abcbedbaca226ea36.tar.gz
Change-Id: I6ff19cc9220deee8a506e9ed4e64e1e644244537
-rw-r--r--adb/client/file_sync_client.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/adb/client/file_sync_client.cpp b/adb/client/file_sync_client.cpp
index e686973db..3374812d5 100644
--- a/adb/client/file_sync_client.cpp
+++ b/adb/client/file_sync_client.cpp
@@ -477,6 +477,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);
}
}