[TASKMGR] Fix a heap corruption bug (#4311)
authorValerij Zaporogeci <vlrzprgts@gmail.com>
Tue, 25 Jan 2022 14:49:46 +0000 (16:49 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Jan 2022 14:49:46 +0000 (15:49 +0100)
Improper adjustment of the array index in graphctl.c, introduced in PR #4141 lead to an off-by-one heap corruption.

base/applications/taskmgr/graphctl.c

index 0d15f4d..4253eea 100644 (file)
@@ -150,7 +150,7 @@ GraphCtrl_AddPoint(PTM_GRAPH_CONTROL inst, BYTE val0, BYTE val1)
     t = inst->PointBuffer;
     Prev0 = *(t + inst->CurrIndex);
     Prev1 = *(t + inst->CurrIndex + inst->NumberOfPoints);
-    if (inst->CurrIndex < inst->NumberOfPoints)
+    if (inst->CurrIndex < inst->NumberOfPoints - 1)
     {
         inst->CurrIndex++;
     }