From 3f16c8615c816c7617d478bcc155e3ae26ea3226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 17 Jun 2021 16:38:32 +0200 Subject: [PATCH] [NTOS:IO] Check RtlCreateUnicodeString return value when initializing PnP services CORE-17637 --- ntoskrnl/io/pnpmgr/pnpinit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/pnpinit.c b/ntoskrnl/io/pnpmgr/pnpinit.c index b189ac8280a..b1a5e24c8e5 100644 --- a/ntoskrnl/io/pnpmgr/pnpinit.c +++ b/ntoskrnl/io/pnpmgr/pnpinit.c @@ -435,8 +435,11 @@ IopInitializePlugPlayServices(VOID) DNF_IDS_QUERIED | DNF_NO_RESOURCE_REQUIRED; /* Create instance path */ - RtlCreateUnicodeString(&IopRootDeviceNode->InstancePath, - REGSTR_VAL_ROOT_DEVNODE); + if (!RtlCreateUnicodeString(&IopRootDeviceNode->InstancePath, REGSTR_VAL_ROOT_DEVNODE)) + { + DPRINT1("RtlCreateUnicodeString() failed\n"); + KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0); + } /* Call the add device routine */ IopRootDriverObject->DriverExtension->AddDevice(IopRootDriverObject,