2
0
Эх сурвалжийг харах

* Fixed r44960. Also copy a trailing implicit #0 of the original string to the new larger string.

git-svn-id: trunk@44970 -
yury 5 жил өмнө
parent
commit
c3954a0cee
1 өөрчлөгдсөн 6 нэмэгдсэн , 2 устгасан
  1. 6 2
      rtl/inc/astrings.inc

+ 6 - 2
rtl/inc/astrings.inc

@@ -798,8 +798,12 @@ begin
           Temp:=NewAnsiString(L);
           PAnsiRec(Pointer(Temp)-AnsiFirstOff)^.CodePage:=PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage;
           lens:=length(s);
-          if l<lens then
-            lens:=l;
+          if l<=lens then
+            lens:=l
+          else
+            { Also copy a trailing implicit #0 of the original string
+              to the new larger string }
+            Inc(lens);
           Move(Pointer(S)^,Temp^,lens);
           fpc_ansistr_decr_ref(Pointer(s));
           Pointer(S):=Temp;