Piotr Caban : advapi32: Validate arguments in StartServiceCtrlDispatcher.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 13:42:45 CDT 2012


Module: wine
Branch: master
Commit: 6027fe2dafa89456d9f000d8c4b0a879737ed2e0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6027fe2dafa89456d9f000d8c4b0a879737ed2e0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Oct 22 14:25:13 2012 +0200

advapi32: Validate arguments in StartServiceCtrlDispatcher.

---

 dlls/advapi32/service.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 49d56d1..2ec6d8e 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -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++)




More information about the wine-cvs mailing list