mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:09:19 +02:00
* buffer overflow checking in ptccrt.KeyBufAdd
git-svn-id: trunk@16141 -
This commit is contained in:
parent
ba6a4760e9
commit
e7c4990780
@ -79,7 +79,10 @@ end;
|
|||||||
|
|
||||||
procedure KeyBufAdd(Ch: Char);
|
procedure KeyBufAdd(Ch: Char);
|
||||||
begin
|
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;
|
KeyBuffer[KeyBufTail] := Ch;
|
||||||
Inc(KeyBufTail);
|
Inc(KeyBufTail);
|
||||||
if KeyBufTail > High(KeyBuffer) then
|
if KeyBufTail > High(KeyBuffer) then
|
||||||
|
Loading…
Reference in New Issue
Block a user