mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 09:40:29 +02:00
* dereference pchar passed to indexbyte in strecopy (patch by Andrew Haines,
mantis #21443) git-svn-id: trunk@20481 -
This commit is contained in:
parent
d289d3d4ce
commit
3ebdd64d75
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
20
tests/webtbs/tw21443.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user