Browse Source

* provide terminating #0's to wide and stringfields, Patch from Ludo Brands
Mantis 199222

git-svn-id: trunk@18140 -

marco 14 years ago
parent
commit
cf061cd3ae
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/fcl-db/src/base/fields.inc

+ 4 - 0
packages/fcl-db/src/base/fields.inc

@@ -1102,6 +1102,7 @@ begin
   if DataSize <= dsMaxStringSize then
     begin
     Result:=GetData(@Buf);
+    buf[Size]:=#0;  //limit string to Size
     If Result then
       begin
       if transliterate then
@@ -1117,6 +1118,7 @@ begin
     begin
     SetLength(DynBuf,DataSize);
     Result:=GetData(@DynBuf[0]);
+    Dynbuf[Size]:=#0;  //limit string to Size
     If Result then
       begin
       if transliterate then
@@ -1223,11 +1225,13 @@ var
 begin
   if DataSize <= dsMaxStringSize then begin
     Result := GetData(@FixBuffer, False);
+    FixBuffer[Size]:=#0;     //limit string to Size
     aValue := FixBuffer;
   end else begin
     SetLength(DynBuffer, Succ(Size));
     Buffer := PWideChar(DynBuffer);
     Result := GetData(Buffer, False);
+    Buffer[Size]:=#0;     //limit string to Size
     if Result then
       aValue := Buffer;
   end;