mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 17:30:32 +00:00
[NTOS:KD] Don't assume null termination in KdpSerialDebugPrint and KdpScreenPrint. CORE-14057 CORE-14103
This commit is contained in:
parent
a0fe72e218
commit
a07b569b25
1 changed files with 3 additions and 4 deletions
|
@ -340,7 +340,7 @@ KdpSerialDebugPrint(LPSTR Message,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output the message */
|
/* Output the message */
|
||||||
while (*pch != 0)
|
while (pch < Message + Length && *pch != '\0')
|
||||||
{
|
{
|
||||||
if (*pch == '\n')
|
if (*pch == '\n')
|
||||||
{
|
{
|
||||||
|
@ -412,7 +412,7 @@ KdpScreenPrint(LPSTR Message,
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PCHAR pch = (PCHAR) Message;
|
PCHAR pch = (PCHAR) Message;
|
||||||
|
|
||||||
while (*pch)
|
while (pch < Message + Length && *pch)
|
||||||
{
|
{
|
||||||
if(*pch == '\b')
|
if(*pch == '\b')
|
||||||
{
|
{
|
||||||
|
@ -584,9 +584,8 @@ KdpPrintString(
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForRead(UnsafeString, Length, 1);
|
ProbeForRead(UnsafeString, Length, 1);
|
||||||
String = _alloca(Length + 1);
|
String = _alloca(Length);
|
||||||
RtlCopyMemory(String, UnsafeString, Length);
|
RtlCopyMemory(String, UnsafeString, Length);
|
||||||
String[Length] = ANSI_NULL;
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue