mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 20:29:28 +01:00
* provide terminating #0's to wide and stringfields, Patch from Ludo Brands
Mantis 199222 git-svn-id: trunk@18140 -
This commit is contained in:
parent
084c06586a
commit
cf061cd3ae
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user