summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-25 01:29:48 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-25 01:29:48 +0200
commitcb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823 (patch)
tree4a456529ef5df649da7785d343c878e806570cdf
parentam 3b753ad5: am dd738c11: Merge "applypatch: Support flash mode." (diff)
parentam 6a4a33e3: Merge "applypatch: Fix the checking in WriteToPartition()." (diff)
downloadandroid_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar.gz
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar.bz2
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar.lz
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar.xz
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.tar.zst
android_bootable_recovery-cb0e7f2da04b7dcaef50ec7a942cd5b5e64b4823.zip
-rw-r--r--applypatch/applypatch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 2446b2a68..751d3e392 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -312,13 +312,14 @@ int SaveFileContents(const char* filename, const FileContents* file) {
}
// Write a memory buffer to 'target' partition, a string of the form
-// "MTD:<partition>[:...]" or "EMMC:<partition_device>". Return 0 on
-// success.
+// "MTD:<partition>[:...]" or "EMMC:<partition_device>[:...]". The target name
+// might contain multiple colons, but WriteToPartition() only uses the first
+// two and ignores the rest. Return 0 on success.
int WriteToPartition(unsigned char* data, size_t len, const char* target) {
std::string copy(target);
std::vector<std::string> pieces = android::base::Split(copy, ":");
- if (pieces.size() != 2) {
+ if (pieces.size() < 2) {
printf("WriteToPartition called with bad target (%s)\n", target);
return -1;
}