https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d419e90f92890f55d5179ff8578d274cbfcc1f4

commit 2d419e90f92890f55d5179ff8578d274cbfcc1f4
Author:     Thomas Faber <[email protected]>
AuthorDate: Sat Apr 20 10:49:13 2019 +0200
Commit:     Thomas Faber <[email protected]>
CommitDate: Wed Jul 10 10:58:47 2019 +0200

    [NTOS:PNP] Reduce the default buffer size in EnumerateDevices. CORE-15882
---
 ntoskrnl/io/pnpmgr/pnproot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c
index 65ea5cc937b..03ae98131d6 100644
--- a/ntoskrnl/io/pnpmgr/pnproot.c
+++ b/ntoskrnl/io/pnpmgr/pnproot.c
@@ -461,7 +461,8 @@ EnumerateDevices(
     DeviceExtension = 
(PPNPROOT_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
     KeAcquireGuardedMutex(&DeviceExtension->DeviceListLock);
 
-    KeyInfoSize = sizeof(KEY_BASIC_INFORMATION) + (MAX_PATH + 1) * 
sizeof(WCHAR);
+    /* Should hold most key names, but we reallocate below if it's too small */
+    KeyInfoSize = FIELD_OFFSET(KEY_BASIC_INFORMATION, Name) + 64 * 
sizeof(WCHAR);
     KeyInfo = ExAllocatePoolWithTag(PagedPool,
                                     KeyInfoSize + sizeof(UNICODE_NULL),
                                     TAG_PNP_ROOT);

Reply via email to