Skip to content

Commit b926212

Browse files
authored
Fix FSWatcher Unix symlink reading (#108)
Set StringBuilder capacity to PATH_MAX (4096) as Syscall.readlink checks the buffer size and truncates the path to fit in the given buffer.
1 parent ca84ca1 commit b926212

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Plugins/Watchers/FSWatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ private bool IsFileSymlink(string path)
8686
private void LoadWatcherSymlink(string path)
8787
{
8888
StringBuilder str = StringPool.Take();
89+
str.Capacity = 4096;
8990
try
9091
{
9192
int count = Syscall.readlink(path, str);
@@ -124,7 +125,6 @@ private void LoadWatcherSymlink(string path)
124125
{
125126
StringPool.Return(str);
126127
}
127-
128128
}
129129

130130
/// <summary>

0 commit comments

Comments
 (0)