Commit fd0bec1f authored by Damian Dixon's avatar Damian Dixon Committed by Alexandre Julliard

advapi32: Added check for NULL pointer being passed to QueryServiceStatus for either parameter.

parent a2d1c7df
...@@ -1130,6 +1130,17 @@ BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, ...@@ -1130,6 +1130,17 @@ BOOL WINAPI QueryServiceStatus(SC_HANDLE hService,
TRACE("%p %p\n", hService, lpservicestatus); TRACE("%p %p\n", hService, lpservicestatus);
if (!hService)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!lpservicestatus)
{
SetLastError(ERROR_INVALID_ADDRESS);
return FALSE;
}
ret = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&SvcStatusData, ret = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&SvcStatusData,
sizeof(SERVICE_STATUS_PROCESS), &dummy); sizeof(SERVICE_STATUS_PROCESS), &dummy);
if (ret) memcpy(lpservicestatus, &SvcStatusData, sizeof(SERVICE_STATUS)) ; if (ret) memcpy(lpservicestatus, &SvcStatusData, sizeof(SERVICE_STATUS)) ;
......
...@@ -925,7 +925,6 @@ static void test_query_svc(void) ...@@ -925,7 +925,6 @@ static void test_query_svc(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = QueryServiceStatus(svc_handle, NULL); ret = QueryServiceStatus(svc_handle, NULL);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_ADDRESS || ok(GetLastError() == ERROR_INVALID_ADDRESS ||
GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */, GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */,
"Unexpected last error %d\n", GetLastError()); "Unexpected last error %d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment