mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[INCLUDE] Safely handle odd & large lengths in ProbeAndCaptureUnicodeString.
This commit is contained in:
@@ -180,7 +180,18 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
|
||||
|
||||
/* Set it as the buffer */
|
||||
Dest->Buffer = Buffer;
|
||||
Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
|
||||
if (Dest->Length % sizeof(WCHAR))
|
||||
{
|
||||
Dest->Length--;
|
||||
}
|
||||
if (Dest->Length >= UNICODE_STRING_MAX_BYTES)
|
||||
{
|
||||
Dest->MaximumLength = Dest->Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user