Torge Matthies : ntdll: Use correct output buffer size in RtlpNtEnumerateSubKey.

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:48 CDT 2022


Module: wine
Branch: master
Commit: cf7cb993b8527008cc28a0c8f92f8710c2d258b3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cf7cb993b8527008cc28a0c8f92f8710c2d258b3

Author: Torge Matthies <tmatthies at codeweavers.com>
Date:   Sun May  1 02:48:23 2022 +0200

ntdll: Use correct output buffer size in RtlpNtEnumerateSubKey.

Signed-off-by: Torge Matthies <tmatthies at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/reg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 294b724a5e5..106ee620cda 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -91,9 +91,9 @@ NTSTATUS WINAPI RtlpNtEnumerateSubKey( HANDLE handle, UNICODE_STRING *out, ULONG
   DWORD dwLen, dwResultLen;
   NTSTATUS ret;
 
-  if (out->Length)
+  if (out->MaximumLength)
   {
-    dwLen = out->Length + sizeof(KEY_BASIC_INFORMATION);
+    dwLen = out->MaximumLength + sizeof(KEY_BASIC_INFORMATION);
     info = RtlAllocateHeap( GetProcessHeap(), 0, dwLen );
     if (!info)
       return STATUS_NO_MEMORY;
@@ -111,7 +111,7 @@ NTSTATUS WINAPI RtlpNtEnumerateSubKey( HANDLE handle, UNICODE_STRING *out, ULONG
     out->Length = dwResultLen;
   else if (!ret)
   {
-    if (out->Length < info->NameLength)
+    if (out->MaximumLength < info->NameLength)
     {
       out->Length = dwResultLen;
       ret = STATUS_BUFFER_OVERFLOW;




More information about the wine-cvs mailing list