[LDR] Actually allocate what is asked for
authorMark Jansen <mark.jansen@reactos.org>
Fri, 28 Dec 2018 18:27:09 +0000 (19:27 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Thu, 3 Jan 2019 21:52:18 +0000 (22:52 +0100)
dll/ntdll/ldr/ldrutils.c

index 5b6e26a..4aa1cfb 100644 (file)
@@ -52,7 +52,7 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut,
     /* Allocate the string*/
     StringOut->Buffer = RtlAllocateHeap(LdrpHeap,
                                         0,
     /* Allocate the string*/
     StringOut->Buffer = RtlAllocateHeap(LdrpHeap,
                                         0,
-                                        StringOut->Length + sizeof(WCHAR));
+                                        Length + sizeof(WCHAR));
     if (!StringOut->Buffer)
     {
         /* Fail */
     if (!StringOut->Buffer)
     {
         /* Fail */
@@ -61,13 +61,13 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut,
     }
 
     /* Null-terminate it */
     }
 
     /* 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 */
 
     /* 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 */
     {
         /* 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
     {
     }
     else
     {