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

Commit 9d227e92 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

init: expand prop in 'file'

am: 567f1874

Change-Id: I87a2cd6fd5c38b6c216687596d734040329c8e0e
parents 877436dd 567f1874
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -756,6 +756,11 @@ Result<Success> Service::ParseFile(std::vector<std::string>&& args) {
    if (args[2] != "r" && args[2] != "w" && args[2] != "rw") {
        return Error() << "file type must be 'r', 'w' or 'rw'";
    }
    std::string expanded;
    if (!expand_props(args[1], &expanded)) {
        return Error() << "Could not expand property in file path '" << args[1] << "'";
    }
    args[1] = std::move(expanded);
    if ((args[1][0] != '/') || (args[1].find("../") != std::string::npos)) {
        return Error() << "file name must not be relative";
    }