Ver código fonte

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

git-svn-id: trunk@11870 -
michael 17 anos atrás
pai
commit
b40d826439
1 arquivos alterados com 7 adições e 1 exclusões
  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 :