init: expand prop in 'file' am: 567f1874fd

am: 9d227e921f

Change-Id: Id51b5f55a583d09ec644cf83ab1b121ce798062e
This commit is contained in:
Yifan Hong 2019-03-26 15:36:18 -07:00 committed by android-build-merger
commit 396dd7d2e8

View file

@ -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";
}