fix some heap corruptions in services

svn path=/trunk/; revision=36131
This commit is contained in:
Christoph von Wittich 2008-09-11 08:31:52 +00:00
parent 3460318121
commit eac6a1546a
2 changed files with 3 additions and 3 deletions

View file

@ -61,7 +61,7 @@ ScmSetServiceGroup(PSERVICE lpService,
lpGroup = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(SERVICE_GROUP) + (wcslen(lpGroupName) * sizeof(WCHAR)));
sizeof(SERVICE_GROUP) + ((wcslen(lpGroupName) + 1)* sizeof(WCHAR)));
if (lpGroup == NULL)
return ERROR_NOT_ENOUGH_MEMORY;
@ -144,7 +144,7 @@ CreateGroupListRoutine(PWSTR ValueName,
Group = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(SERVICE_GROUP) + (wcslen((const wchar_t*) ValueData) * sizeof(WCHAR)));
sizeof(SERVICE_GROUP) + ((wcslen((const wchar_t*) ValueData) + 1) * sizeof(WCHAR)));
if (Group == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;

View file

@ -164,7 +164,7 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
Ptr = (MANAGER_HANDLE*) HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR));
sizeof(MANAGER_HANDLE) + (wcslen(lpDatabaseName) + 1) * sizeof(WCHAR));
if (Ptr == NULL)
return ERROR_NOT_ENOUGH_MEMORY;