diff --git a/lexer.cpp b/lexer.cpp index 071f00623e..92c2399398 100644 --- a/lexer.cpp +++ b/lexer.cpp @@ -270,6 +270,9 @@ void lexer::read(token &out) { return; } + // In order for strcmp to work, we need to null-terminate the string. + chars.push_back('\0'); + if (!strcmp(&chars[0], "version")) { out.asDirective.type = directive::kVersion;