mirror of
https://github.com/reactos/reactos.git
synced 2024-08-25 04:38:43 +00:00
Fix a bug in ScServiceMainStub(), add more checks.
svn path=/trunk/; revision=26672
This commit is contained in:
parent
107cb5719e
commit
5b30480967
|
@ -101,7 +101,7 @@ ScServiceMainStub(LPVOID Context)
|
||||||
lpPtr = lpService->Arguments;
|
lpPtr = lpService->Arguments;
|
||||||
while (*lpPtr)
|
while (*lpPtr)
|
||||||
{
|
{
|
||||||
DPRINT("arg: %S\n", *lpPtr);
|
DPRINT("arg: %S\n", lpPtr);
|
||||||
dwLen = wcslen(lpPtr) + 1;
|
dwLen = wcslen(lpPtr) + 1;
|
||||||
dwArgCount++;
|
dwArgCount++;
|
||||||
dwLength += dwLen;
|
dwLength += dwLen;
|
||||||
|
@ -153,9 +153,15 @@ ScServiceMainStub(LPVOID Context)
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (AnsiLength == 0)
|
||||||
|
return ERROR_INVALID_PARAMETER; /* ? */
|
||||||
|
|
||||||
AnsiString = HeapAlloc(GetProcessHeap(),
|
AnsiString = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
AnsiLength);
|
AnsiLength + 1);
|
||||||
|
if (AnsiString == NULL)
|
||||||
|
return ERROR_OUTOFMEMORY;
|
||||||
|
|
||||||
WideCharToMultiByte(CP_ACP,
|
WideCharToMultiByte(CP_ACP,
|
||||||
0,
|
0,
|
||||||
lpService->Arguments,
|
lpService->Arguments,
|
||||||
|
@ -165,9 +171,13 @@ ScServiceMainStub(LPVOID Context)
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
AnsiString[AnsiLength] = ANSI_NULL;
|
||||||
|
|
||||||
lpArgVector = HeapAlloc(GetProcessHeap(),
|
lpArgVector = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
(dwArgCount + 1) * sizeof(LPSTR));
|
(dwArgCount + 1) * sizeof(LPSTR));
|
||||||
|
if (lpArgVector == NULL)
|
||||||
|
return ERROR_OUTOFMEMORY;
|
||||||
|
|
||||||
dwArgCount = 0;
|
dwArgCount = 0;
|
||||||
Ptr = AnsiString;
|
Ptr = AnsiString;
|
||||||
|
|
Loading…
Reference in a new issue