Module: wine Branch: master Commit: fd0bec1f960407ba4a4411e41d7585274ebe5ad6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd0bec1f960407ba4a4411e41d...
Author: Damian Dixon damian.dixon@gmail.com Date: Mon Dec 20 20:34:49 2010 +0000
advapi32: Added check for NULL pointer being passed to QueryServiceStatus for either parameter.
---
dlls/advapi32/service.c | 11 +++++++++++ dlls/advapi32/tests/service.c | 1 - 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 5d09d18..92790c1 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -1130,6 +1130,17 @@ BOOL WINAPI QueryServiceStatus(SC_HANDLE hService,
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, sizeof(SERVICE_STATUS_PROCESS), &dummy); if (ret) memcpy(lpservicestatus, &SvcStatusData, sizeof(SERVICE_STATUS)) ; diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index 48d9386..4605ffd 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -925,7 +925,6 @@ static void test_query_svc(void) SetLastError(0xdeadbeef); ret = QueryServiceStatus(svc_handle, NULL); ok(!ret, "Expected failure\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_ADDRESS || GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */, "Unexpected last error %d\n", GetLastError());