From eac6a1546a5a2f1348e7b8f63d458bf6979f9563 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 11 Sep 2008 08:31:52 +0000 Subject: [PATCH] fix some heap corruptions in services svn path=/trunk/; revision=36131 --- reactos/base/system/services/groupdb.c | 4 ++-- reactos/base/system/services/rpcserver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/base/system/services/groupdb.c b/reactos/base/system/services/groupdb.c index bedfca57ad3..f005263f41e 100644 --- a/reactos/base/system/services/groupdb.c +++ b/reactos/base/system/services/groupdb.c @@ -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; diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c index 997ac86e0c3..9cb3cf91680 100644 --- a/reactos/base/system/services/rpcserver.c +++ b/reactos/base/system/services/rpcserver.c @@ -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;