about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-04-14T08·08+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-04-14T08·08+0000
commita4d2b22c8ca5064f1da614914c7ea336eedd65c4 (patch)
tree6ba789f13a5a70011a0efd8aa67d132eb88431b4 /src/libstore/store.cc
parent87bf541f23723f6a8c7f05c89984c5df0c450ec2 (diff)
* Be stricter in verifying store paths.
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index d85b0608f409..a89e4ed89fa7 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -160,13 +160,14 @@ void copyPath(const Path & src, const Path & dst)
 static bool isInStore(const Path & path)
 {
     return path[0] == '/'
-        && Path(path, 0, nixStore.size()) == nixStore
-        && path.size() > nixStore.size() + 1
-        && path[nixStore.size()] == '/';
+        && path.compare(0, nixStore.size(), nixStore) == 0
+        && path.size() >= nixStore.size() + 2
+        && path[nixStore.size()] == '/'
+        && path.find('/', nixStore.size() + 1) == Path::npos;
 }
 
 
-static void assertStorePath(const Path & path)
+void assertStorePath(const Path & path)
 {
     if (!isInStore(path))
         throw Error(format("path `%1%' is not in the Nix store") % path);