mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:36:04 +00:00
Fix buffer overflow, add some debug prints.
svn path=/trunk/; revision=41076
This commit is contained in:
parent
e7a79115c6
commit
fc4d23fa18
2 changed files with 11 additions and 9 deletions
|
@ -68,7 +68,7 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request,
|
||||||
ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
|
ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
|
||||||
SB_CONNECT_DATA SbConnectData;
|
SB_CONNECT_DATA SbConnectData;
|
||||||
ULONG SbConnectDataLength = sizeof SbConnectData;
|
ULONG SbConnectDataLength = sizeof SbConnectData;
|
||||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||||
|
|
||||||
DPRINT("SM: %s called\n", __FUNCTION__);
|
DPRINT("SM: %s called\n", __FUNCTION__);
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ SmpApiConnectedThread(PVOID pConnectedPort)
|
||||||
HANDLE ConnectedPort = * (PHANDLE) pConnectedPort;
|
HANDLE ConnectedPort = * (PHANDLE) pConnectedPort;
|
||||||
|
|
||||||
DPRINT("SM: %s called\n", __FUNCTION__);
|
DPRINT("SM: %s called\n", __FUNCTION__);
|
||||||
RtlZeroMemory(&Request, sizeof(SM_PORT_MESSAGE));
|
RtlZeroMemory(&Request, sizeof(SM_PORT_MESSAGE));
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
@ -160,10 +160,13 @@ SmpApiConnectedThread(PVOID pConnectedPort)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* LPC failed */
|
/* LPC failed */
|
||||||
|
DPRINT1("SM: %s: NtReplyWaitReceivePort() failed (Status=0x%08lx)\n",
|
||||||
|
__FUNCTION__, Status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NtClose (ConnectedPort);
|
NtClose (ConnectedPort);
|
||||||
|
DPRINT("SM: %s done\n", __FUNCTION__);
|
||||||
NtTerminateThread (NtCurrentThread(), Status);
|
NtTerminateThread (NtCurrentThread(), Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +270,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request)
|
||||||
__FUNCTION__, Status);
|
__FUNCTION__, Status);
|
||||||
return Status;
|
return Status;
|
||||||
} else {
|
} else {
|
||||||
DPRINT("SM: %s: completing conn req\n", __FUNCTION__);
|
DPRINT("SM: %s: completing connection request\n", __FUNCTION__);
|
||||||
Status = NtCompleteConnectPort (*ClientDataApiPort);
|
Status = NtCompleteConnectPort (*ClientDataApiPort);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -293,6 +296,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request)
|
||||||
* necessary in NT LPC, because server side connected ports are
|
* necessary in NT LPC, because server side connected ports are
|
||||||
* never used to receive requests.
|
* never used to receive requests.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
SmpApiThread (HANDLE ListeningPort)
|
SmpApiThread (HANDLE ListeningPort)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +327,7 @@ SmpApiThread (HANDLE ListeningPort)
|
||||||
/* DIE */
|
/* DIE */
|
||||||
NtTerminateThread(NtCurrentThread(), Status);
|
NtTerminateThread(NtCurrentThread(), Status);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* LPC PORT INITIALIZATION **************************************************/
|
/* LPC PORT INITIALIZATION **************************************************/
|
||||||
|
|
||||||
|
@ -338,7 +342,7 @@ NTSTATUS
|
||||||
SmCreateApiPort(VOID)
|
SmCreateApiPort(VOID)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes = {0};
|
OBJECT_ATTRIBUTES ObjectAttributes = {0};
|
||||||
UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(L"\\SmApiPort");
|
UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(SM_API_PORT_NAME);
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $Id$ */
|
|
||||||
#ifndef __SM_API_H
|
#ifndef __SM_API_H
|
||||||
#define __SM_API_H
|
#define __SM_API_H
|
||||||
|
|
||||||
|
@ -107,7 +106,7 @@ typedef struct _SM_PORT_MESSAGE_QRYINFO
|
||||||
|
|
||||||
/*** | ****************************************************************/
|
/*** | ****************************************************************/
|
||||||
|
|
||||||
typedef union _SM_PORT_MESSAGE
|
typedef struct _SM_PORT_MESSAGE
|
||||||
{
|
{
|
||||||
/*** LPC common header ***/
|
/*** LPC common header ***/
|
||||||
PORT_MESSAGE Header;
|
PORT_MESSAGE Header;
|
||||||
|
@ -115,7 +114,6 @@ typedef union _SM_PORT_MESSAGE
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
UCHAR LpcHeader[sizeof(PORT_MESSAGE)];
|
|
||||||
/*** SM common header ***/
|
/*** SM common header ***/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -139,7 +137,7 @@ typedef union _SM_PORT_MESSAGE
|
||||||
} Reply;
|
} Reply;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
UCHAR PadBuffer[PORT_MAXIMUM_MESSAGE_LENGTH];
|
SM_CONNECT_DATA ConnectData;
|
||||||
};
|
};
|
||||||
} SM_PORT_MESSAGE, * PSM_PORT_MESSAGE;
|
} SM_PORT_MESSAGE, * PSM_PORT_MESSAGE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue