forked from lix-project/lix
Fix use after free in content-address.cc
Inspired by https://github.com/NixOS/nix/pull/5599
This commit is contained in:
parent
ee5f291709
commit
b26cb0c9ac
|
@ -120,8 +120,10 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
|
||||||
|
|
||||||
ContentAddressMethod parseContentAddressMethod(std::string_view caMethod)
|
ContentAddressMethod parseContentAddressMethod(std::string_view caMethod)
|
||||||
{
|
{
|
||||||
std::string_view asPrefix {std::string{caMethod} + ":"};
|
std::string asPrefix = std::string{caMethod} + ":";
|
||||||
return parseContentAddressMethodPrefix(asPrefix);
|
// parseContentAddressMethodPrefix takes its argument by reference
|
||||||
|
std::string_view asPrefixView = asPrefix;
|
||||||
|
return parseContentAddressMethodPrefix(asPrefixView);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt)
|
std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt)
|
||||||
|
|
Loading…
Reference in a new issue