Explorar o código

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

Rika Ichinose %!s(int64=2) %!d(string=hai) anos
pai
achega
0d3d4918b3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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;
 function fpc_pchar_length(p:PAnsiChar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
 begin
 begin
   if assigned(p) then
   if assigned(p) then
-    Result:=IndexByte(p^,high(Result),0)
+    Result:=IndexByte(p^,-1,0)
   else
   else
     Result:=0;
     Result:=0;
 end;
 end;