From 7eaab9254948e928e1fa3cb57bfc8bc5a0c5ed9e Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 24 Aug 2012 12:52:29 +0000 Subject: [PATCH] =?utf8?q?[ADVAPI32]=20-=20Correctly=20handle=20NULL=20pas?= =?utf8?q?swords=20for=20services.=20Patch=20by=20Herm=C3=A8s=20B=C3=A9lus?= =?utf8?q?ca.=20Fixes=20crash=20in=20advapi32=5Fwinetest:service.=20See=20?= =?utf8?q?bug=207239,=20bug=207293.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=57150 --- reactos/dll/win32/advapi32/service/scm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/advapi32/service/scm.c b/reactos/dll/win32/advapi32/service/scm.c index 97fcf8edaaa..0fcee5b8fa9 100644 --- a/reactos/dll/win32/advapi32/service/scm.c +++ b/reactos/dll/win32/advapi32/service/scm.c @@ -309,7 +309,7 @@ ChangeServiceConfigA(SC_HANDLE hService, /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR); + dwPasswordLength = (lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); RpcTryExcept { @@ -387,7 +387,7 @@ ChangeServiceConfigW(SC_HANDLE hService, /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR); + dwPasswordLength = (lpPassword ? (wcslen(lpPassword) + 1) * sizeof(WCHAR) : 0); RpcTryExcept { @@ -577,7 +577,7 @@ CreateServiceA(SC_HANDLE hSCManager, /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR); + dwPasswordLength = (lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); RpcTryExcept { @@ -671,7 +671,7 @@ CreateServiceW(SC_HANDLE hSCManager, /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR); + dwPasswordLength = (lpPassword ? (wcslen(lpPassword) + 1) * sizeof(WCHAR) : 0); RpcTryExcept { -- 2.17.1