浏览代码

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 -
svenbarth 9 年之前
父节点
当前提交
77cb13c38c
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      rtl/inc/wstrings.inc

+ 1 - 1
rtl/inc/wstrings.inc

@@ -586,7 +586,7 @@ begin
   Pos:=0;
   if (Length(SubStr)>0) and (Offset>0) and (Offset<Length(Source)) then
    begin
-     MaxLen:=Length(source)-Length(SubStr)-(OffSet-1);
+     MaxLen:=Length(source)-Length(SubStr);
      i:=Offset-1;
      pc:=@source[Offset];
      while (i<=MaxLen) do