[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
This commit is contained in:
Oleg Dubinskiy 2022-12-07 23:15:42 +01:00 committed by GitHub
parent 1341c384f2
commit 82cf6c2b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;