Skip to content

Commit ccfc39e

Browse files
committed
Fix string length issue
1 parent 313f86b commit ccfc39e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ public unsafe string TryGetProcessFilename(Process p)
105105
{
106106
return string.Empty;
107107
}
108-
}
109108

110-
return new string(buffer, 0, (int)capacity);
109+
int validLength = Array.IndexOf(buffer, '\0');
110+
if (validLength < 0) validLength = (int)capacity;
111+
return new string(buffer, 0, validLength);
112+
}
111113
}
112114
catch
113115
{

0 commit comments

Comments
 (0)