[automerge] Backport of Win-specific suppression of potentially rogue construct that can 2p: b5ad48db08 2p: ec686d808c am: 4b97e0654e am: ceab4f320d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/adb/+/17606169
Change-Id: I2ca35b987c680178da06fc0052584fc5d73cc74b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/client/file_sync_client.cpp b/client/file_sync_client.cpp
index 1b1dfa8..5a587db 100644
--- a/client/file_sync_client.cpp
+++ b/client/file_sync_client.cpp
@@ -544,15 +544,17 @@
if (!ReadFdExactly(fd, buf, len)) return false;
buf[len] = 0;
-
- // Address the highly unlikely scenario wherein a
+ // 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 (strchr(buf, '/')
+#if defined(_WIN32)
+ || strchr(buf, '\\')
+#endif
+ ) {
return false;
}
-
callback(dent.mode, dent.size, dent.mtime, buf);
}
}