1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Merge pull request #11951 from Mic92/libstore

source-accessor: fix case where normalization goes beyond root
This commit is contained in:
Jörg Thalheim 2024-11-25 15:46:18 +01:00 committed by GitHub
commit 3180c09723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,9 +84,10 @@ CanonPath SourceAccessor::resolveSymlinks(
todo.pop_front();
if (c == "" || c == ".")
;
else if (c == "..")
res.pop();
else {
else if (c == "..") {
if (!res.isRoot())
res.pop();
} else {
res.push(c);
if (mode == SymlinkResolution::Full || !todo.empty()) {
if (auto st = maybeLstat(res); st && st->type == SourceAccessor::tSymlink) {