Skip to content

Commit bd59111

Browse files
authored
Avoid possible out of range index in MatchSpec::parse() (#3849)
1 parent 26785a6 commit bd59111

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libmamba/src/specs/match_spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ namespace mamba::specs
505505
auto MatchSpec::parse(std::string_view str) -> expected_parse_t<MatchSpec>
506506
{
507507
// Remove comments, i.e. everything after ` #` (space included)
508-
if (const auto idx = str.find('#'); idx != std::string::npos && str[idx - 1] == ' ')
508+
if (const auto idx = str.find(" #"); idx != std::string::npos)
509509
{
510510
str = str.substr(0, idx);
511511
}

0 commit comments

Comments
 (0)