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