mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:09:20 +02:00
Revert r33057. MaxLen is the maximum value that Pos can return and does not need to be adjusted by (Offset - 1). Also there's no buffer that could be overrun as i is not used to access the string's buffer. Fixes failure of tests/test/units/system/tstring.pp
git-svn-id: trunk@33089 -
This commit is contained in:
parent
e23ed15634
commit
77cb13c38c
@ -586,7 +586,7 @@ begin
|
|||||||
Pos:=0;
|
Pos:=0;
|
||||||
if (Length(SubStr)>0) and (Offset>0) and (Offset<Length(Source)) then
|
if (Length(SubStr)>0) and (Offset>0) and (Offset<Length(Source)) then
|
||||||
begin
|
begin
|
||||||
MaxLen:=Length(source)-Length(SubStr)-(OffSet-1);
|
MaxLen:=Length(source)-Length(SubStr);
|
||||||
i:=Offset-1;
|
i:=Offset-1;
|
||||||
pc:=@source[Offset];
|
pc:=@source[Offset];
|
||||||
while (i<=MaxLen) do
|
while (i<=MaxLen) do
|
||||||
|
Loading…
Reference in New Issue
Block a user