https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f66a7e2e482f6dbcf1710…
commit f66a7e2e482f6dbcf171018a60e6807d5a66a6ba
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Jan 6 00:51:43 2020 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Oct 31 14:23:16 2020 +0100
[NTOS:KE:X64] Zero out the context in KiDispatchException
---
ntoskrnl/ke/amd64/except.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/ke/amd64/except.c b/ntoskrnl/ke/amd64/except.c
index 23ff7e016a9..40b01064d84 100644
--- a/ntoskrnl/ke/amd64/except.c
+++ b/ntoskrnl/ke/amd64/except.c
@@ -245,10 +245,13 @@ KiDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
/* Increase number of Exception Dispatches */
KeGetCurrentPrcb()->KeExceptionDispatchCount++;
+ /* Zero out the context to avoid leaking kernel stack memor to user mode */
+ RtlZeroMemory(&Context, sizeof(Context));
+
/* Set the context flags */
Context.ContextFlags = CONTEXT_ALL;
- /* Get a Context */
+ /* Get the Context from the trap and exception frame */
KeTrapFrameToContext(TrapFrame, ExceptionFrame, &Context);
/* Look at our exception code */