Unverified Commit 2ae65ae4 authored by Daniel Hiltgen's avatar Daniel Hiltgen Committed by GitHub
Browse files

win: handle more than 2048 processes (#10997)

Fix an array out of bounds crash
parent a3b6886b
...@@ -74,7 +74,16 @@ func isProcRunning(procName string) []uint32 { ...@@ -74,7 +74,16 @@ func isProcRunning(procName string) []uint32 {
slog.Debug("failed to check for running installers", "error", err) slog.Debug("failed to check for running installers", "error", err)
return nil return nil
} }
pids = pids[:ret] if ret > uint32(len(pids)) {
pids = make([]uint32, ret+10)
if err := windows.EnumProcesses(pids, &ret); err != nil || ret == 0 {
slog.Debug("failed to check for running installers", "error", err)
return nil
}
}
if ret < uint32(len(pids)) {
pids = pids[:ret]
}
var matches []uint32 var matches []uint32
for _, pid := range pids { for _, pid := range pids {
if pid == 0 { if pid == 0 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment