mirror of
https://github.com/reactos/reactos.git
synced 2026-05-26 19:02:18 +08:00
[NTOS:KD] Avoid _alloca inside SEH, as it's apparently incompatible with PSEH. CORE-14103
This commit is contained in:
@@ -574,17 +574,18 @@ KdpPrintString(
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PKD_DISPATCH_TABLE CurrentTable;
|
||||
PCHAR String;
|
||||
CHAR StringBuffer[512];
|
||||
|
||||
if (!KdpDebugMode.Value) return 0;
|
||||
|
||||
Length = min(Length, 512);
|
||||
Length = min(Length, sizeof(StringBuffer));
|
||||
|
||||
if (ExGetPreviousMode() != KernelMode)
|
||||
{
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead(UnsafeString, Length, 1);
|
||||
String = _alloca(Length);
|
||||
String = StringBuffer;
|
||||
RtlCopyMemory(String, UnsafeString, Length);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
|
||||
@@ -220,14 +220,15 @@ KdpPrompt(IN LPSTR PromptString,
|
||||
{
|
||||
STRING PromptBuffer, ResponseBuffer;
|
||||
BOOLEAN Enable, Resend;
|
||||
PVOID CapturedPrompt;
|
||||
CHAR CapturedPrompt[512];
|
||||
CHAR SafeResponseBuffer[512];
|
||||
PCHAR SafeResponseString;
|
||||
|
||||
/* Normalize the lengths */
|
||||
PromptLength = min(PromptLength,
|
||||
512);
|
||||
sizeof(CapturedPrompt));
|
||||
MaximumResponseLength = min(MaximumResponseLength,
|
||||
512);
|
||||
sizeof(SafeResponseBuffer));
|
||||
|
||||
/* Check if we need to verify the string */
|
||||
if (PreviousMode != KernelMode)
|
||||
@@ -241,7 +242,6 @@ KdpPrompt(IN LPSTR PromptString,
|
||||
1);
|
||||
|
||||
/* Capture prompt */
|
||||
CapturedPrompt = _alloca(PromptLength);
|
||||
KdpMoveMemory(CapturedPrompt,
|
||||
PromptString,
|
||||
PromptLength);
|
||||
@@ -251,7 +251,7 @@ KdpPrompt(IN LPSTR PromptString,
|
||||
ProbeForWrite(ResponseString,
|
||||
MaximumResponseLength,
|
||||
1);
|
||||
SafeResponseString = _alloca(MaximumResponseLength);
|
||||
SafeResponseString = SafeResponseBuffer;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
@@ -3675,12 +3675,14 @@ KdpPrompt(
|
||||
KIRQL OldIrql;
|
||||
PCHAR InString;
|
||||
PCHAR OutString;
|
||||
CHAR InStringBuffer[512];
|
||||
CHAR OutStringBuffer[512];
|
||||
|
||||
/* Normalize the lengths */
|
||||
InStringLength = min(InStringLength,
|
||||
512);
|
||||
sizeof(InStringBuffer));
|
||||
OutStringLength = min(OutStringLength,
|
||||
512);
|
||||
sizeof(OutStringBuffer));
|
||||
|
||||
/* Check if we need to verify the string */
|
||||
if (PreviousMode != KernelMode)
|
||||
@@ -3694,7 +3696,7 @@ KdpPrompt(
|
||||
1);
|
||||
|
||||
/* Capture prompt */
|
||||
InString = _alloca(InStringLength);
|
||||
InString = InStringBuffer;
|
||||
RtlCopyMemory(InString,
|
||||
UnsafeInString,
|
||||
InStringLength);
|
||||
@@ -3703,7 +3705,7 @@ KdpPrompt(
|
||||
ProbeForWrite(UnsafeOutString,
|
||||
OutStringLength,
|
||||
1);
|
||||
OutString = _alloca(OutStringLength);
|
||||
OutString = OutStringBuffer;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user