SML parser: prevent out-of-bound array access

array nodes has MAX_TREE_SIZE elements, so the maximum index allowed to
use to access an element of nodes is one less, not MAX_TREE_SIZE.
This commit is contained in:
Bernhard Kirchen 2024-06-14 22:57:12 +02:00
parent a1138a2202
commit 1afa9a6d90

View File

@ -80,7 +80,7 @@ void pushListBuffer(unsigned char byte)
void reduceList()
{
if (currentLevel <= MAX_TREE_SIZE && nodes[currentLevel] > 0)
if (currentLevel < MAX_TREE_SIZE && nodes[currentLevel] > 0)
nodes[currentLevel]--;
}