瀏覽代碼

* fixed fpc_shortstr_concat() in case the max length for the destination is
already smaller than the length of the first string (probably cannot
happen currently, but may be in the future as a result of optimizations)

git-svn-id: trunk@17886 -

Jonas Maebe 14 年之前
父節點
當前提交
c5dfa9d354
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      rtl/inc/generic.inc

+ 5 - 1
rtl/inc/generic.inc

@@ -930,7 +930,11 @@ begin
   s1l:=length(s1);
   s1l:=length(s1);
   s2l:=length(s2);
   s2l:=length(s2);
   if s1l+s2l>high(dests) then
   if s1l+s2l>high(dests) then
-    s2l:=high(dests)-s1l;
+    begin
+      if s1l>high(dests) then
+        s1l:=high(dests);
+      s2l:=high(dests)-s1l;
+    end;
   if @dests=@s1 then
   if @dests=@s1 then
     move(s2[1],dests[s1l+1],s2l)
     move(s2[1],dests[s1l+1],s2l)
   else
   else