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 */