2
0
Эх сурвалжийг харах

* buffer overflow checking in ptccrt.KeyBufAdd

git-svn-id: trunk@16141 -
nickysn 15 жил өмнө
parent
commit
e7c4990780

+ 4 - 1
packages/graph/src/ptcgraph/ptccrt.pp

@@ -79,7 +79,10 @@ end;
 
 procedure KeyBufAdd(Ch: Char);
 begin
-  {todo: overflow checking}
+  { do nothing, if the buffer is full }
+  if ((KeyBufTail + 1) = KeyBufHead) or
+     ((KeyBufTail = High(KeyBuffer)) and (KeyBufHead = Low(KeyBuffer))) then
+    exit;
   KeyBuffer[KeyBufTail] := Ch;
   Inc(KeyBufTail);
   if KeyBufTail > High(KeyBuffer) then