Skip to content

Commit c8074d2

Browse files
lsp: Limit resolvesToRegularFile()'s recursion depth to 10.
1 parent 3fc7deb commit c8074d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libsolidity/lsp/LanguageServer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ namespace fs = boost::filesystem;
5858
namespace
5959
{
6060

61-
bool resolvesToRegularFile(boost::filesystem::path _path)
61+
bool resolvesToRegularFile(boost::filesystem::path _path, int maxRecursionDepth = 10)
6262
{
6363
fs::file_status fileStatus = fs::status(_path);
6464

65-
while (fileStatus.type() == fs::file_type::symlink_file)
65+
while (fileStatus.type() == fs::file_type::symlink_file && maxRecursionDepth > 0)
6666
{
6767
_path = boost::filesystem::read_symlink(_path);
6868
fileStatus = fs::status(_path);
69+
maxRecursionDepth--;
6970
}
7071

7172
return fileStatus.type() == fs::file_type::regular_file;

0 commit comments

Comments
 (0)