win: handle more than 2048 processes (#10997)
Fix an array out of bounds crash
This commit is contained in:
parent
a3b6886b7d
commit
2ae65ae471
|
|
@ -74,7 +74,16 @@ func isProcRunning(procName string) []uint32 {
|
|||
slog.Debug("failed to check for running installers", "error", err)
|
||||
return nil
|
||||
}
|
||||
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
|
||||
for _, pid := range pids {
|
||||
if pid == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue