Correct parsing of the process ID returned by interatcive service

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/194/head
Selva Nair 2017-10-13 23:37:17 -04:00
parent 82812df1a8
commit 8eb06fa697
1 changed files with 2 additions and 1 deletions

View File

@ -1173,7 +1173,8 @@ OnService(connection_t *c, UNUSED char *msg)
}
p = buf + 11;
if (!err && swscanf (p, L"0x%08x\nProcess ID", &pid) == 1 && pid != 0)
/* next line is the pid if followed by "\nProcess ID" */
if (!err && wcsstr(p, L"\nProcess ID") && swscanf (p, L"0x%08x", &pid) == 1 && pid != 0)
{
PrintDebug (L"Process ID of openvpn started by IService: %d", pid);
c->hProcess = OpenProcess (PROCESS_TERMINATE|PROCESS_QUERY_INFORMATION, FALSE, pid);