small change: fix for potential array bounds violation

This commit is contained in:
Frank
2022-10-18 13:40:46 +02:00
parent a6dd9c737f
commit 36bd7147cc

View File

@@ -681,7 +681,7 @@ class Lexer {
for (JsonPair tokenPair: definitionJson["TOKENS"].as<JsonObject>()) {
const char * value = tokenPair.value();
char currentValue[charLength];
char currentValue[charLength+1];
strncpy(currentValue, this->text + this->pos, charLength);
currentValue[strlen(value)] = '\0';
if (strcmp(value, currentValue) == 0 && strlen(value) > longestTokenLength) {