soong: paths: Fix out of tree $OUT

Change-Id: Ia915a7fcb95c76272fff6d350dc69abacb7b9e00
This commit is contained in:
Cosmin Tanislav 2024-03-20 23:16:26 -04:00 committed by Bartłomiej Rudecki
parent 878adb61bf
commit 8b82c0d750
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -2020,7 +2020,7 @@ func validatePathInternal(allowNinjaVariables bool, pathComponents ...string) (s
}
path := filepath.Clean(path)
if path == ".." || strings.HasPrefix(path, "../") || strings.HasPrefix(path, "/") {
if path == ".." || strings.HasPrefix(path, "../") || i != initialEmpty && strings.HasPrefix(path, "/") {
return "", fmt.Errorf("Path is outside directory: %s", path)
}