From 74201126b66ae1c333f8b13166cdb586271297a7 Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Fri, 4 Mar 2022 23:59:26 +0100 Subject: [PATCH] [0.4.7][SERVICES] RChangeServiceConfig2A(): Zero-Initialize InfoW variable CORE-14521 This lets forward NULL Info.psd/Info.psd->lpDescription/Info.psfa, instead of an uninitialized value. Currently this branch does not show the bug CORE-14521, but that is just because it doesn't use the more mean "advapi32 : service" test of 0.4.10. If we would port back the newer test from 0.4.9-dev-555-g 3c1b7834e15b652076c21d2d4ed8232d522b971a , then we would see it hanging as well. fix picked from 0.4.10-dev-627-g e3a1c2c81b2e1167552cbb8f8ca1d774e025ccd7 ------- I also muted a forgotten DPRINT1, like it was done during 0.4.10-dev'ing on master and fixed some whitespace indentation, like it was done during 0.4.9-dev'ing on master --- base/system/services/rpcserver.c | 55 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c index 3465d4da307..e6db645345d 100644 --- a/base/system/services/rpcserver.c +++ b/base/system/services/rpcserver.c @@ -1234,36 +1234,36 @@ DWORD RControlService( if (dwError == ERROR_SUCCESS) { - if (dwControl == SERVICE_CONTROL_STOP || - dwControl == SERVICE_CONTROL_PAUSE || - dwControl == SERVICE_CONTROL_CONTINUE) + if (dwControl == SERVICE_CONTROL_STOP || + dwControl == SERVICE_CONTROL_PAUSE || + dwControl == SERVICE_CONTROL_CONTINUE) + { + /* Log a successful send control */ + + switch (dwControl) { - /* Log a successful send control */ + case SERVICE_CONTROL_STOP: + uID = IDS_SERVICE_STOP; + break; - switch (dwControl) - { - case SERVICE_CONTROL_STOP: - uID = IDS_SERVICE_STOP; - break; + case SERVICE_CONTROL_PAUSE: + uID = IDS_SERVICE_PAUSE; + break; - case SERVICE_CONTROL_PAUSE: - uID = IDS_SERVICE_PAUSE; - break; - - case SERVICE_CONTROL_CONTINUE: - uID = IDS_SERVICE_RESUME; - break; - } - LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80); - - lpLogStrings[0] = lpService->lpDisplayName; - lpLogStrings[1] = szLogBuffer; - - ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS, - EVENTLOG_INFORMATION_TYPE, - 2, - lpLogStrings); + case SERVICE_CONTROL_CONTINUE: + uID = IDS_SERVICE_RESUME; + break; } + LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80); + + lpLogStrings[0] = lpService->lpDisplayName; + lpLogStrings[1] = szLogBuffer; + + ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS, + EVENTLOG_INFORMATION_TYPE, + 2, + lpLogStrings); + } } return dwError; @@ -2436,7 +2436,6 @@ DWORD RCreateServiceW( goto done; } -DPRINT1("\n"); /* Write the security descriptor */ dwError = ScmWriteSecurityDescriptor(hServiceKey, lpService->pSecurityDescriptor); @@ -4936,7 +4935,7 @@ DWORD RChangeServiceConfig2A( SC_RPC_HANDLE hService, SC_RPC_CONFIG_INFOA Info) { - SC_RPC_CONFIG_INFOW InfoW; + SC_RPC_CONFIG_INFOW InfoW = { 0 }; DWORD dwRet, dwLength; PVOID ptr = NULL;