Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a4a33e3 authored by Tao Bao's avatar Tao Bao Committed by Gerrit Code Review
Browse files

Merge "applypatch: Fix the checking in WriteToPartition()."

parents dd738c11 1ce7a2a6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;
    }