mirror of
https://github.com/NixOS/nix
synced 2025-06-29 23:13:14 +02:00
source-accessor: fix case where normalization goes beyond root
fixes https://github.com/NixOS/nix/issues/11936
This commit is contained in:
parent
3e9cc78eb5
commit
3fb7481e64
1 changed files with 4 additions and 3 deletions
|
@ -84,9 +84,10 @@ CanonPath SourceAccessor::resolveSymlinks(
|
||||||
todo.pop_front();
|
todo.pop_front();
|
||||||
if (c == "" || c == ".")
|
if (c == "" || c == ".")
|
||||||
;
|
;
|
||||||
else if (c == "..")
|
else if (c == "..") {
|
||||||
|
if (!res.isRoot())
|
||||||
res.pop();
|
res.pop();
|
||||||
else {
|
} else {
|
||||||
res.push(c);
|
res.push(c);
|
||||||
if (mode == SymlinkResolution::Full || !todo.empty()) {
|
if (mode == SymlinkResolution::Full || !todo.empty()) {
|
||||||
if (auto st = maybeLstat(res); st && st->type == SourceAccessor::tSymlink) {
|
if (auto st = maybeLstat(res); st && st->type == SourceAccessor::tSymlink) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue