From: Mark Jansen Date: Fri, 28 Dec 2018 18:27:09 +0000 (+0100) Subject: [LDR] Actually allocate what is asked for X-Git-Tag: 0.4.13-dev~795 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=aa912422e5c5ca4e7c396429d719101f8a08ea09 [LDR] Actually allocate what is asked for --- 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 {