mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 14:34:57 +08:00
[LDR] Actually allocate what is asked for
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user