mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 08:47:59 +02:00
TFileSearcher: first attempt to try to avoid circular links (infinite loop when recuring directories).
Part of issue #40689.
This commit is contained in:
parent
9f02bfab4a
commit
7b1e04c5d8
@ -863,7 +863,13 @@ var
|
||||
if (PathInfo.Name = '.') or (PathInfo.Name = '..') or
|
||||
(PathInfo.Name = '') or ((PathInfo.Attr and faDirectory) = 0) or
|
||||
(not FFollowSymLink and FileIsSymlink(APath + PathInfo.Name)) or
|
||||
(not AcceptDir(APath+PathInfo.Name))
|
||||
(FileIsSymlink(APath + PathInfo.Name) and
|
||||
( //try to detect the simples case of a circular link
|
||||
//is the link "up or down the current tree": infinite loop if we follow
|
||||
FileIsInPath(ExpandFilenameUTF8(ReadAllLinks(APath+PathInfo.Name,False)),ExpandFilenameUTF8(APath)) or
|
||||
FileIsInPath(ExpandFilenameUTF8(APath),ExpandFilenameUTF8(ReadAllLinks(APath+PathInfo.Name,False))))
|
||||
) or
|
||||
(not AcceptDir(PathInfo.Name))
|
||||
then Continue;
|
||||
|
||||
FPath := APath;
|
||||
|
Loading…
Reference in New Issue
Block a user