From aa912422e5c5ca4e7c396429d719101f8a08ea09 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Fri, 28 Dec 2018 19:27:09 +0100 Subject: [PATCH] [LDR] Actually allocate what is asked for --- dll/ntdll/ldr/ldrutils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dll/ntdll/ldr/ldrutils.c b/dll/ntdll/ldr/ldrutils.c index 5b6e26abd93..4aa1cfb1c1b 100644 --- a/dll/ntdll/ldr/ldrutils.c +++ b/dll/ntdll/ldr/ldrutils.c @@ -52,7 +52,7 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut, /* Allocate the string*/ StringOut->Buffer = RtlAllocateHeap(LdrpHeap, 0, - StringOut->Length + sizeof(WCHAR)); + Length + sizeof(WCHAR)); if (!StringOut->Buffer) { /* Fail */ @@ -61,13 +61,13 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut, } /* Null-terminate it */ - StringOut->Buffer[StringOut->Length / sizeof(WCHAR)] = UNICODE_NULL; + StringOut->Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL; /* Check if this is a maximum-sized string */ - if (StringOut->Length != UNICODE_STRING_MAX_BYTES) + if (Length != UNICODE_STRING_MAX_BYTES) { /* It's not, so set the maximum length to be one char more */ - StringOut->MaximumLength = StringOut->Length + sizeof(UNICODE_NULL); + StringOut->MaximumLength = Length + sizeof(UNICODE_NULL); } else {