From: Thomas Faber Date: Fri, 24 Aug 2012 12:52:29 +0000 (+0000) Subject: [ADVAPI32] X-Git-Tag: backups/ros-csrss@57560~398 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=7eaab9254948e928e1fa3cb57bfc8bc5a0c5ed9e [ADVAPI32] - Correctly handle NULL passwords for services. Patch by Hermès Bélusca. Fixes crash in advapi32_winetest:service. See bug 7239, bug 7293. svn path=/trunk/; revision=57150 --- 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 {