* dereference pchar passed to indexbyte in strecopy (patch by Andrew Haines,

mantis )

git-svn-id: trunk@20481 -
This commit is contained in:
Jonas Maebe 2012-03-08 18:55:49 +00:00
parent d289d3d4ce
commit 3ebdd64d75
3 changed files with 22 additions and 1 deletions

1
.gitattributes vendored
View File

@ -12237,6 +12237,7 @@ tests/webtbs/tw2128.pp svneol=native#text/plain
tests/webtbs/tw2129.pp svneol=native#text/plain
tests/webtbs/tw2129b.pp svneol=native#text/plain
tests/webtbs/tw2131.pp svneol=native#text/plain
tests/webtbs/tw21443.pp svneol=native#text/plain
tests/webtbs/tw2145.pp svneol=native#text/plain
tests/webtbs/tw2158.pp svneol=native#text/plain
tests/webtbs/tw2159.pp svneol=native#text/plain

View File

@ -203,7 +203,7 @@
var
counter : SizeInt;
Begin
counter := IndexByte(Source,-1,0);
counter := IndexByte(Source^,-1,0);
{ counter+1 will move zero terminator }
Move(Source^,Dest^,counter+1);
StrECopy := Dest+counter;

20
tests/webtbs/tw21443.pp Normal file
View File

@ -0,0 +1,20 @@
uses
strings;
var
p1, p2, p3, p4: pchar;
begin
{ StrECopy(Dest,Source) is equivalent to the following:
strcopy(Dest,Source);
StrECopy := StrEnd(Dest);
}
p1:='abcdefg';
getmem(p2,100);
p3:=strecopy(p2,p1);
fillchar(p2^,100,0);
strcopy(p2,p1);
p4:=strend(p2);
if p3<>p4 then
halt(1);
end.