https://git.reactos.org/?p=reactos.git;a=commitdiff;h=82cf6c2b069906f50bb1a…
commit 82cf6c2b069906f50bb1a24a921f451ce5338366
Author: Oleg Dubinskiy <oleg.dubinskij30(a)gmail.com>
AuthorDate: Wed Dec 7 23:15:42 2022 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Dec 8 01:15:42 2022 +0300
[NTOS:IO] Properly zero-initialize a file object created by IopParseDevice (#4931)
Fix uninitialized kernel memory leakage for a case when a file object extension is
appended.
CORE-18711
---
ntoskrnl/io/iomgr/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/io/iomgr/file.c b/ntoskrnl/io/iomgr/file.c
index 548c7f28db7..bfe11ab295b 100644
--- a/ntoskrnl/io/iomgr/file.c
+++ b/ntoskrnl/io/iomgr/file.c
@@ -857,7 +857,7 @@ IopParseDevice(IN PVOID ParseObject,
}
/* Clear the file object */
- RtlZeroMemory(FileObject, sizeof(FILE_OBJECT));
+ RtlZeroMemory(FileObject, ObjectSize);
/* Check if this is Synch I/O */
if (OpenPacket->CreateOptions &
@@ -917,6 +917,7 @@ IopParseDevice(IN PVOID ParseObject,
/* Make sure the file object knows it has an extension */
FileObject->Flags |= FO_FILE_OBJECT_HAS_EXTENSION;
+ /* Initialize file object extension */
FileObjectExtension = (PFILE_OBJECT_EXTENSION)(FileObject + 1);
FileObject->FileObjectExtension = FileObjectExtension;