mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 22:46:01 +02:00
* check added to avoid potential SIGSEGV
git-svn-id: trunk@1261 -
This commit is contained in:
parent
da9ea7ff88
commit
022e3ceef8
@ -1352,31 +1352,34 @@ implementation
|
|||||||
startpc,pc : pchar;
|
startpc,pc : pchar;
|
||||||
sepch : char;
|
sepch : char;
|
||||||
begin
|
begin
|
||||||
|
FindFilePchar:=false;
|
||||||
|
if Assigned (Path) then
|
||||||
|
begin
|
||||||
{$ifdef Unix}
|
{$ifdef Unix}
|
||||||
sepch:=':';
|
sepch:=':';
|
||||||
{$else}
|
{$else}
|
||||||
{$ifdef macos}
|
{$ifdef macos}
|
||||||
sepch:=',';
|
sepch:=',';
|
||||||
{$else}
|
{$else}
|
||||||
sepch:=';';
|
sepch:=';';
|
||||||
{$endif macos}
|
{$endif macos}
|
||||||
{$endif Unix}
|
{$endif Unix}
|
||||||
FindFilePchar:=false;
|
pc:=path;
|
||||||
pc:=path;
|
repeat
|
||||||
repeat
|
startpc:=pc;
|
||||||
startpc:=pc;
|
while (pc^<>sepch) and (pc^<>';') and (pc^<>#0) do
|
||||||
while (pc^<>sepch) and (pc^<>';') and (pc^<>#0) do
|
inc(pc);
|
||||||
inc(pc);
|
move(startpc^,singlepathstring[1],pc-startpc);
|
||||||
move(startpc^,singlepathstring[1],pc-startpc);
|
singlepathstring[0]:=char(longint(pc-startpc));
|
||||||
singlepathstring[0]:=char(longint(pc-startpc));
|
singlepathstring:=FixPath(singlepathstring,false);
|
||||||
singlepathstring:=FixPath(singlepathstring,false);
|
result:=FileExistsNonCase(singlepathstring,f,FoundFile);
|
||||||
result:=FileExistsNonCase(singlepathstring,f,FoundFile);
|
if result then
|
||||||
if result then
|
exit;
|
||||||
exit;
|
if (pc^=#0) then
|
||||||
if (pc^=#0) then
|
break;
|
||||||
break;
|
inc(pc);
|
||||||
inc(pc);
|
until false;
|
||||||
until false;
|
end;
|
||||||
foundfile:=f;
|
foundfile:=f;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user