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

Commit bb134b26 authored by Tao Bao's avatar Tao Bao
Browse files

uncrypt: Fix the comparison in FindBlockDevice().

Previously it considered a match if the given path (i.e. path to an
update package) fully equals to a mount_point.  For example, `uncrypt
/data block.map` or `uncrypt /vendor block.map` would exit successfully,
without producing a block map.

Test: `uncrypt /path/to/package.zip block.map`
Test: `uncrypt /vendor block.map` fails.
Change-Id: Id946ab1c0b158b623013f89463cbb1960141d8b5
parent d1670a06
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -174,9 +174,7 @@ static std::string FindBlockDevice(const std::string& path, bool* encryptable, b
    if (entry.mount_point.empty()) {
      continue;
    }
    auto len = entry.mount_point.size();
    if (android::base::StartsWith(path, entry.mount_point) &&
        (path[len] == '/' || path[len] == 0)) {
    if (android::base::StartsWith(path, entry.mount_point + "/")) {
      *encrypted = false;
      *encryptable = false;
      if (entry.is_encryptable() || entry.fs_mgr_flags.file_encryption) {