[LDR] Actually allocate what is asked for

This commit is contained in:
Mark Jansen 2018-12-28 19:27:09 +01:00
parent 3e9cf62470
commit aa912422e5
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -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
{