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

Commit f5a6fb99 authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi Committed by Songchun Fan
Browse files

[incfs] Fix the unsafe memory copy in IncrementalService

Better to protect the memcpy() and zero-out the target

Bug: 183160959
Test: atest IncrementalService
Change-Id: I3daca749168a8c5a32b1eedc7992006cbe2e9eb4
parent 4375a745
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -280,8 +280,8 @@ binder::Status BinderIncrementalService::getMetadataByPath(int32_t storageId,
}

static FileId toFileId(const std::vector<uint8_t>& id) {
    FileId fid;
    memcpy(&fid, id.data(), id.size());
    FileId fid = {};
    memcpy(&fid, id.data(), std::min(sizeof(fid), id.size()));
    return fid;
}