[NTOSKRNL]

- Probe input buffer for read in NtSetSystemInformation() and call the helpers function in a PSEH block
- For the NtSetSytemInformation - SystemSessionCreate specific case, as we return session ID, probe for write directly there.

svn path=/trunk/; revision=68223
This commit is contained in:
Pierre Schweitzer 2015-06-21 08:06:25 +00:00
parent c37f5f9e7c
commit c6f9fe3713

View file

@ -2068,6 +2068,8 @@ SSI_DEF(SystemSessionCreate)
{ {
return STATUS_PRIVILEGE_NOT_HELD; return STATUS_PRIVILEGE_NOT_HELD;
} }
ProbeForWriteUlong(Buffer);
} }
Status = MmSessionCreate(&SessionId); Status = MmSessionCreate(&SessionId);
@ -2452,26 +2454,24 @@ NtSetSystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
IN PVOID SystemInformation, IN PVOID SystemInformation,
IN ULONG SystemInformationLength) IN ULONG SystemInformationLength)
{ {
NTSTATUS Status = STATUS_INVALID_INFO_CLASS;
KPROCESSOR_MODE PreviousMode;
PAGED_CODE(); PAGED_CODE();
PreviousMode = ExGetPreviousMode();
_SEH2_TRY
{
/* /*
* If called from user mode, check * If called from user mode, check
* possible unsafe arguments. * possible unsafe arguments.
*/ */
#if 0 if (PreviousMode != KernelMode)
if (KernelMode != KeGetPreviousMode())
{ {
// Check arguments ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
//ProbeForWrite(
// SystemInformation,
// Length
// );
//ProbeForWrite(
// ResultLength,
// sizeof (ULONG)
// );
} }
#endif
/* /*
* Check the request is valid. * Check the request is valid.
*/ */
@ -2483,12 +2483,18 @@ NtSetSystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
/* /*
* Hand the request to a subhandler. * Hand the request to a subhandler.
*/ */
return CallQS [SystemInformationClass].Set(SystemInformation, Status = CallQS [SystemInformationClass].Set(SystemInformation,
SystemInformationLength); SystemInformationLength);
} }
} }
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
return STATUS_INVALID_INFO_CLASS; return Status;
} }
NTSTATUS NTSTATUS