From 376fbc524227d278604f252dc86ec715e968bec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 17 Jun 2021 16:45:28 +0200 Subject: [PATCH] [NTOS:MM] Check result of RtlCreateUnicodeString in MmGetFileNameForAddress CORE-17637 --- ntoskrnl/mm/ARM3/section.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index fa4bb52d999..4a65209d38b 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -1927,11 +1927,13 @@ MmGetFileNameForAddress(IN PVOID Address, if (NT_SUCCESS(Status)) { /* Init modulename */ - RtlCreateUnicodeString(ModuleName, ModuleNameInformation->Name.Buffer); + if (!RtlCreateUnicodeString(ModuleName, ModuleNameInformation->Name.Buffer)) + Status = STATUS_INSUFFICIENT_RESOURCES; /* Free temp taged buffer from MmGetFileNameForFileObject() */ ExFreePoolWithTag(ModuleNameInformation, TAG_MM); - DPRINT("Found ModuleName %S by address %p\n", ModuleName->Buffer, Address); + + DPRINT("Found ModuleName %wZ by address %p\n", ModuleName, Address); } /* Return status */