1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11: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(); 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) {