1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 14:53:16 +02:00

source-accessor: fix case where normalization goes beyond root

fixes https://github.com/NixOS/nix/issues/11936
This commit is contained in:
Jörg Thalheim 2024-11-24 11:17:17 +01:00
parent 3e9cc78eb5
commit 3fb7481e64

View file

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