https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ad4ef6002fc2fdd9e636…
commit 0ad4ef6002fc2fdd9e636fa98384859c39d68e1c
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Aug 9 21:13:08 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Aug 11 23:01:05 2018 +0200
[NTOSKRNL] Check that caller has appropriate right before creating page file
---
ntoskrnl/mm/pagefile.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c
index a30d920d22..523422fcf5 100644
--- a/ntoskrnl/mm/pagefile.c
+++ b/ntoskrnl/mm/pagefile.c
@@ -509,13 +509,18 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
if (MmNumberOfPagingFiles >= MAX_PAGING_FILES)
{
- return(STATUS_TOO_MANY_PAGING_FILES);
+ return STATUS_TOO_MANY_PAGING_FILES;
}
PreviousMode = ExGetPreviousMode();
if (PreviousMode != KernelMode)
{
+ if (SeSinglePrivilegeCheck(SeCreatePagefilePrivilege, PreviousMode) != TRUE)
+ {
+ return STATUS_PRIVILEGE_NOT_HELD;
+ }
+
_SEH2_TRY
{
SafeInitialSize = ProbeForReadLargeInteger(InitialSize);