fix(daemon): Validate process handle and ID before shutdown
This commit is contained in:
parent
901dacf593
commit
8a2b6bd688
1 changed files with 10 additions and 0 deletions
|
|
@ -121,6 +121,16 @@ void MSWindowsProcess::shutdown(HANDLE handle, DWORD pid, int timeout)
|
|||
{
|
||||
LOG_DEBUG("shutting down process %d", pid);
|
||||
|
||||
if (handle == nullptr) {
|
||||
LOG_ERR("invalid process handle, cannot shutdown process %d", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
LOG_ERR("invalid process id, cannot shutdown process %d", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("sending close event to close process gracefully");
|
||||
HANDLE hCloseEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, kCloseEventName);
|
||||
if (hCloseEvent != nullptr) { // NOSONAR -- Readability
|
||||
|
|
|
|||
Loading…
Reference in a new issue