From ccfc39e54a35fb552cc563f1fa8660e99ffe1037 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 10 Dec 2024 15:12:35 +0800 Subject: [PATCH] Fix string length issue --- Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs index d8e5f4fb7..6df12fae9 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs @@ -105,9 +105,11 @@ namespace Flow.Launcher.Plugin.ProcessKiller { return string.Empty; } - } - return new string(buffer, 0, (int)capacity); + int validLength = Array.IndexOf(buffer, '\0'); + if (validLength < 0) validLength = (int)capacity; + return new string(buffer, 0, validLength); + } } catch {