mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
[INCLUDE] Safely handle odd & large lengths in ProbeAndCaptureUnicodeString.
This commit is contained in:
parent
975e117780
commit
0d26bbf4b5
1 changed files with 12 additions and 1 deletions
|
@ -180,8 +180,19 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
|
||||||
|
|
||||||
/* Set it as the buffer */
|
/* Set it as the buffer */
|
||||||
Dest->Buffer = Buffer;
|
Dest->Buffer = Buffer;
|
||||||
|
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);
|
Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Sanitize structure */
|
/* Sanitize structure */
|
||||||
|
|
Loading…
Reference in a new issue