mirror of https://github.com/mamba-org/mamba.git
Avoid possible out of range index in MatchSpec::parse() (#3849)
This commit is contained in:
parent
26785a6b50
commit
bd591115a1
|
@ -505,7 +505,7 @@ namespace mamba::specs
|
|||
auto MatchSpec::parse(std::string_view str) -> expected_parse_t<MatchSpec>
|
||||
{
|
||||
// Remove comments, i.e. everything after ` #` (space included)
|
||||
if (const auto idx = str.find('#'); idx != std::string::npos && str[idx - 1] == ' ')
|
||||
if (const auto idx = str.find(" #"); idx != std::string::npos)
|
||||
{
|
||||
str = str.substr(0, idx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue