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