Skip to content
Snippets Groups Projects
Commit 4021f530 authored by Troy Rollo's avatar Troy Rollo Committed by Alexandre Julliard
Browse files

Return an empty string for service dependencies when there are no

dependencies, rather than a NULL pointer, which causes some apps to
SEGV.
parent 64db5331
No related branches found
No related tags found
No related merge requests found
......@@ -1792,6 +1792,8 @@ QueryServiceConfigW( SC_HANDLE hService,
r = RegQueryValueExW( hKey, szDependencies, 0, &type, NULL, &sz );
if( ( r == ERROR_SUCCESS ) && ( type == REG_MULTI_SZ ) )
total += sz;
else
total += sizeof(WCHAR);
sz = 0;
r = RegQueryValueExW( hKey, szStart, 0, &type, NULL, &sz );
......@@ -1862,12 +1864,18 @@ QueryServiceConfigW( SC_HANDLE hService,
sz = n;
r = RegQueryValueExW( hKey, szDependencies, 0, &type, p, &sz );
lpServiceConfig->lpDependencies = (LPWSTR) p;
if( ( r == ERROR_SUCCESS ) || ( type == REG_SZ ) )
{
lpServiceConfig->lpDependencies = (LPWSTR) p;
p += sz;
n -= sz;
}
else
{
*(WCHAR *) p = 0;
p += sizeof(WCHAR);
n -= sizeof(WCHAR);
}
if( n < 0 )
ERR("Buffer overflow!\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment