diff --git a/reactos/subsystems/win32/win32k/ntuser/misc.c b/reactos/subsystems/win32/win32k/ntuser/misc.c index 93ef1d9876f..6d2a58b1aa5 100644 --- a/reactos/subsystems/win32/win32k/ntuser/misc.c +++ b/reactos/subsystems/win32/win32k/ntuser/misc.c @@ -2397,10 +2397,10 @@ IntSafeCopyUnicodeString(PUNICODE_STRING Dest, Src = Dest->Buffer; Dest->Buffer = NULL; + Dest->MaximumLength = Dest->Length; if(Dest->Length > 0 && Src) { - Dest->MaximumLength = Dest->Length; Dest->Buffer = ExAllocatePoolWithTag(PagedPool, Dest->MaximumLength, TAG_STRING); if(!Dest->Buffer) { @@ -2443,6 +2443,7 @@ IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, Src = Dest->Buffer; Dest->Buffer = NULL; + Dest->MaximumLength = 0; if(Dest->Length > 0 && Src) {