Skip to content

micro fix for system.paramstr()

rtl/linux/system.pp (and for other Unixes too?)

function paramstr(l: longint) : string;
 begin
   { stricly conforming POSIX applications  }
   { have the executing filename as argv[0] }
   if l=0 then
     begin
       if execpathstr='' then
         SysInitExecPath;
       paramstr := execpathstr;
     end
   else if (l < argc) then
     paramstr:=strpas(argv[l])
   else
     paramstr:='';
 end;

Here we miss the check "if (l>0)" to avoid crash on negative argument.

Edited by Alexey Torgashin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information