summaryrefslogtreecommitdiff
path: root/packages/graph
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-10-12 14:17:35 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-10-12 14:17:35 +0000
commit335201524263216a0262b7f38d08004c2e8d2727 (patch)
treee6add4a55a6ca17f624b6a9801f00eb2b28d0c8d /packages/graph
parente7e06925377e600e9145635af8779c1045fed2c3 (diff)
downloadfpc-335201524263216a0262b7f38d08004c2e8d2727.tar.gz
* buffer overflow checking in ptccrt.KeyBufAdd
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16141 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/graph')
-rw-r--r--packages/graph/src/ptcgraph/ptccrt.pp5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/graph/src/ptcgraph/ptccrt.pp b/packages/graph/src/ptcgraph/ptccrt.pp
index 0b3d152f3f..8c792d9520 100644
--- a/packages/graph/src/ptcgraph/ptccrt.pp
+++ b/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