mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTOS] Addendum to 03873aee
: check that the computed size of the OEM-converted string is less than MAXUSHORT.
This commit is contained in:
parent
5c77cd9050
commit
b2bad34b9b
1 changed files with 9 additions and 5 deletions
|
@ -778,6 +778,7 @@ NtDisplayString(IN PUNICODE_STRING DisplayString)
|
|||
NTSTATUS Status;
|
||||
UNICODE_STRING CapturedString;
|
||||
OEM_STRING OemString;
|
||||
ULONG OemLength;
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
|
||||
PAGED_CODE();
|
||||
|
@ -806,11 +807,14 @@ NtDisplayString(IN PUNICODE_STRING DisplayString)
|
|||
* We cannot perform the allocation using RtlUnicodeStringToOemString()
|
||||
* since its allocator uses PagedPool.
|
||||
*/
|
||||
RtlInitEmptyAnsiString((PANSI_STRING)&OemString, NULL,
|
||||
RtlUnicodeStringToOemSize(&CapturedString));
|
||||
OemString.Buffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||
OemString.MaximumLength,
|
||||
TAG_OSTR);
|
||||
OemLength = RtlUnicodeStringToOemSize(&CapturedString);
|
||||
if (OemLength > MAXUSHORT)
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
goto Quit;
|
||||
}
|
||||
RtlInitEmptyAnsiString((PANSI_STRING)&OemString, NULL, (USHORT)OemLength);
|
||||
OemString.Buffer = ExAllocatePoolWithTag(NonPagedPool, OemLength, TAG_OSTR);
|
||||
if (OemString.Buffer == NULL)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
|
|
Loading…
Reference in a new issue