Avoid possible out of range index in MatchSpec::parse() (#3849)

This commit is contained in:
Orion Poplawski 2025-03-17 08:37:04 -06:00 committed by GitHub
parent 26785a6b50
commit bd591115a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}