Skip to content

Commit

Permalink
Merge pull request #1276 from KrisThielemans/parsingFix
Browse files Browse the repository at this point in the history
fix buffer-overrun when parsing if no keyword on line
  • Loading branch information
KrisThielemans authored Oct 25, 2023
2 parents 24811e6 + 594f113 commit 5d49e59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/buildblock/KeyParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ string
KeyParser::get_keyword(const string& line) const
{
// keyword stops at either := or an index []
string::size_type eok = line.find_first_of(":[",0);
auto eok = line.find_first_of(":[",0);
// check that = follows : to allow keywords containing colons
while (line[eok] == ':' && eok+1 < line.size() && line[eok+1] != '=')
while (eok != string::npos && line[eok] == ':' && eok+1 < line.size() && line[eok+1] != '=')
{
eok = line.find_first_of(":[", eok+1);
}
Expand Down

0 comments on commit 5d49e59

Please sign in to comment.