Browse Source

* make sure that when making an ansistring shorter using setlength(),
it remains null-terminated

git-svn-id: branches/jvmbackend@18883 -

Jonas Maebe 14 years ago
parent
commit
7c56dbee12
1 changed files with 2 additions and 0 deletions
  1. 2 0
      rtl/java/astrings.inc

+ 2 - 0
rtl/java/astrings.inc

@@ -417,6 +417,8 @@ begin
     result:=s;
   { +1 for terminating #0 }
   setlength(AnsistringClass(result).fdata,l+1);
+  { null-terminate in case the string became shorter }
+  AnsistringClass(result).fdata[l]:=#0;
 end;
 
 {*****************************************************************************