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

Mantis 199222

git-svn-id: trunk@18140 -
This commit is contained in:
marco 2011-08-07 18:17:56 +00:00
parent 084c06586a
commit cf061cd3ae

View File

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