瀏覽代碼

* Fixed bug #12323. Bug is in getting default value of string parameters, unterminated memory copy

git-svn-id: trunk@11870 -
michael 17 年之前
父節點
當前提交
b40d826439
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      compiler/symdef.pas

+ 7 - 1
compiler/symdef.pas

@@ -2805,7 +2805,13 @@ implementation
                   case hpc.consttyp of
                     conststring,
                     constresourcestring :
-                      hs:=strpas(pchar(hpc.value.valueptr));
+                      begin
+                      If hpc.value.len>0 then
+                        begin
+                        setLength(hs,hpc.value.len);
+                        move(hpc.value.valueptr^,hs[1],hpc.value.len);
+                        end;
+                      end;
                     constreal :
                       str(pbestreal(hpc.value.valueptr)^,hs);
                     constpointer :