mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 01:59:18 +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/tw2129.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2129b.pp svneol=native#text/plain
|
tests/webtbs/tw2129b.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2131.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/tw2145.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2158.pp svneol=native#text/plain
|
tests/webtbs/tw2158.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2159.pp svneol=native#text/plain
|
tests/webtbs/tw2159.pp svneol=native#text/plain
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
var
|
var
|
||||||
counter : SizeInt;
|
counter : SizeInt;
|
||||||
Begin
|
Begin
|
||||||
counter := IndexByte(Source,-1,0);
|
counter := IndexByte(Source^,-1,0);
|
||||||
{ counter+1 will move zero terminator }
|
{ counter+1 will move zero terminator }
|
||||||
Move(Source^,Dest^,counter+1);
|
Move(Source^,Dest^,counter+1);
|
||||||
StrECopy := Dest+counter;
|
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