Author: jgardou
Date: Fri Aug 19 22:15:53 2016
New Revision: 72396
URL:
http://svn.reactos.org/svn/reactos?rev=72396&view=rev
Log:
[SERVICES]
- Properly invalidate service handles when closing/freeing them
Dedicated to Hermès and any regression chaser. FalsePositives--
Modified:
trunk/reactos/base/system/services/rpcserver.c
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Fri Aug 19 22:15:53 2016
@@ -21,6 +21,7 @@
#define MANAGER_TAG 0x72674D68 /* 'hMgr' */
#define SERVICE_TAG 0x63765368 /* 'hSvc' */
+#define INVALID_TAG 0xAABBCCDD
typedef struct _SCMGR_HANDLE
{
@@ -952,7 +953,8 @@
{
DPRINT("Found manager handle\n");
- /* FIXME: add handle cleanup code */
+ /* Make sure we don't access stale memory if someone tries to use this handle
again. */
+ hManager->Handle.Tag = INVALID_TAG;
HeapFree(GetProcessHeap(), 0, hManager);
hManager = NULL;
@@ -972,7 +974,8 @@
/* Get the pointer to the service record */
lpService = hService->ServiceEntry;
- /* FIXME: add handle cleanup code */
+ /* Make sure we don't access stale memory if someone tries to use this handle
again. */
+ hService->Handle.Tag = INVALID_TAG;
/* Free the handle */
HeapFree(GetProcessHeap(), 0, hService);