|
From: <tw...@us...> - 2026-03-07 18:49:32
|
Revision: 868
http://sourceforge.net/p/tdbf/code/868
Author: twm
Date: 2026-03-07 18:49:31 +0000 (Sat, 07 Mar 2026)
Log Message:
-----------
Guard TDynamicType.Append against negative or zero length
Add early-exit check: negative length exits without touching memory,
zero length null-terminates at the current position. Prevents undefined
behavior in Move when a negative length is passed by any caller.
Modified Paths:
--------------
trunk/src/dbf_prsdef.pas
Modified: trunk/src/dbf_prsdef.pas
===================================================================
--- trunk/src/dbf_prsdef.pas 2026-03-07 18:25:39 UTC (rev 867)
+++ trunk/src/dbf_prsdef.pas 2026-03-07 18:49:31 UTC (rev 868)
@@ -1215,6 +1215,12 @@
procedure TDynamicType.Append(Source: Pointer; Length: Integer); // Was PChar
begin
+ if Length <= 0 then
+ begin
+ if Length = 0 then
+ FMemoryPos^^ := #0;
+ exit;
+ end;
// make room for string plus null-terminator
AssureSpace(Length+4);
// copy
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|