advapi32: Validate arguments in StartServiceCtrlDispatcher.

This commit is contained in:
Piotr Caban 2012-10-22 14:25:13 +02:00 committed by Alexandre Julliard
parent e17cdb266d
commit 6027fe2daf
1 changed files with 12 additions and 0 deletions

View File

@ -565,6 +565,12 @@ BOOL WINAPI StartServiceCtrlDispatcherA( const SERVICE_TABLE_ENTRYA *servent )
return FALSE;
}
while (servent[nb_services].lpServiceName) nb_services++;
if (!nb_services)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
services = HeapAlloc( GetProcessHeap(), 0, nb_services * sizeof(*services) );
for (i = 0; i < nb_services; i++)
@ -610,6 +616,12 @@ BOOL WINAPI StartServiceCtrlDispatcherW( const SERVICE_TABLE_ENTRYW *servent )
return FALSE;
}
while (servent[nb_services].lpServiceName) nb_services++;
if (!nb_services)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
services = HeapAlloc( GetProcessHeap(), 0, nb_services * sizeof(*services) );
for (i = 0; i < nb_services; i++)