mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #11187 from Mic92/diff-closure-fix
diff-closures: fix a use after free
This commit is contained in:
commit
88e8c9017a
1 changed files with 6 additions and 4 deletions
|
@ -25,15 +25,17 @@ GroupedPaths getClosureInfo(ref<Store> store, const StorePath & toplevel)
|
|||
|
||||
GroupedPaths groupedPaths;
|
||||
|
||||
for (auto & path : closure) {
|
||||
for (auto const & path : closure) {
|
||||
/* Strip the output name. Unfortunately this is ambiguous (we
|
||||
can't distinguish between output names like "bin" and
|
||||
version suffixes like "unstable"). */
|
||||
static std::regex regex("(.*)-([a-z]+|lib32|lib64)");
|
||||
std::smatch match;
|
||||
std::string name(path.name());
|
||||
std::cmatch match;
|
||||
std::string name{path.name()};
|
||||
std::string_view const origName = path.name();
|
||||
std::string outputName;
|
||||
if (std::regex_match(name, match, regex)) {
|
||||
|
||||
if (std::regex_match(origName.begin(), origName.end(), match, regex)) {
|
||||
name = match[1];
|
||||
outputName = match[2];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue