浏览代码

Don’t allow generic fpc_pchar_length to arbitrarily over-read.

Rika Ichinose 2 年之前
父节点
当前提交
0d3d4918b3
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      rtl/inc/generic.inc

+ 1 - 1
rtl/inc/generic.inc

@@ -1322,7 +1322,7 @@ end;
 function fpc_pchar_length(p:PAnsiChar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
 begin
   if assigned(p) then
-    Result:=IndexByte(p^,high(Result),0)
+    Result:=IndexByte(p^,-1,0)
   else
     Result:=0;
 end;