mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:49:23 +02:00
* make sure that when making an ansistring shorter using setlength(),
it remains null-terminated git-svn-id: branches/jvmbackend@18883 -
This commit is contained in:
parent
3a423b331c
commit
7c56dbee12
@ -417,6 +417,8 @@ begin
|
|||||||
result:=s;
|
result:=s;
|
||||||
{ +1 for terminating #0 }
|
{ +1 for terminating #0 }
|
||||||
setlength(AnsistringClass(result).fdata,l+1);
|
setlength(AnsistringClass(result).fdata,l+1);
|
||||||
|
{ null-terminate in case the string became shorter }
|
||||||
|
AnsistringClass(result).fdata[l]:=#0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user