1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 07:11:47 +02:00

Detect NAR directory entries that collide with another path after case-hacking

The test was made by @puckipedia.
This commit is contained in:
Eelco Dolstra 2024-09-05 19:26:10 +02:00
parent 77c090cdbd
commit 3557587381
3 changed files with 9 additions and 0 deletions

View file

@ -243,6 +243,9 @@ static void parse(FileSystemObjectSink & sink, Source & source, const CanonPath
debug("case collision between '%1%' and '%2%'", i->first, name);
name += caseHackSuffix;
name += std::to_string(++i->second);
auto j = names.find(name);
if (j != names.end())
throw Error("NAR contains file name '%s' that collides with case-hacked file name '%s'", prevName, j->first);
} else
names[name] = 0;
}