aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-09-21 13:45:11 +0200
committerEelco Dolstra <edolstra@gmail.com>2021-09-21 13:45:11 +0200
commit06557299b30f53c6d4a1a2e3068f36d9ef3df904 (patch)
tree3755de60c01fb475e232abd9f5874fccb11cea89 /src
parent5cbb9c5406f3058fcc9f99692490fbc5a4f57876 (diff)
Allow relative paths anywhere into the parent's store path
Diffstat (limited to 'src')
-rw-r--r--src/libfetchers/path.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc
index b35c04cfc..fb5702c4c 100644
--- a/src/libfetchers/path.cc
+++ b/src/libfetchers/path.cc
@@ -95,8 +95,11 @@ struct PathInputScheme : InputScheme
absPath = nix::absPath(path, parent);
// for security, ensure that if the parent is a store path, it's inside it
- if (store->isInStore(parent) && !isInDir(absPath, parent))
- throw BadStorePath("relative path '%s' [%s] points outside of its parent's store path '%s'", path, absPath, parent);
+ if (store->isInStore(parent)) {
+ auto storePath = store->printStorePath(store->toStorePath(parent).first);
+ if (!isInDir(absPath, storePath))
+ throw BadStorePath("relative path '%s' points outside of its parent's store path '%s'", path, storePath);
+ }
} else
absPath = path;