From 6a200446dc5f7126ae43c97fc9cefb8a48d2c325 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 1 May 2015 10:49:50 +0000 Subject: [PATCH] [NTOS:IO] - Add missing SEH around user buffer access in IopCompleteRequest - Remove a redundant condition CORE-9624 svn path=/trunk/; revision=67485 --- reactos/ntoskrnl/io/iomgr/irp.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/reactos/ntoskrnl/io/iomgr/irp.c b/reactos/ntoskrnl/io/iomgr/irp.c index 723ec0551fd..021e65f46b7 100644 --- a/reactos/ntoskrnl/io/iomgr/irp.c +++ b/reactos/ntoskrnl/io/iomgr/irp.c @@ -284,10 +284,18 @@ IopCompleteRequest(IN PKAPC Apc, (Irp->IoStatus.Status != STATUS_VERIFY_REQUIRED) && !(NT_ERROR(Irp->IoStatus.Status))) { - /* Copy the buffer back to the user */ - RtlCopyMemory(Irp->UserBuffer, - Irp->AssociatedIrp.SystemBuffer, - Irp->IoStatus.Information); + _SEH2_TRY + { + /* Copy the buffer back to the user */ + RtlCopyMemory(Irp->UserBuffer, + Irp->AssociatedIrp.SystemBuffer, + Irp->IoStatus.Information); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Do nothing */ + } + _SEH2_END; } /* Also check if we should de-allocate it */ @@ -317,10 +325,9 @@ IopCompleteRequest(IN PKAPC Apc, * (but warnings are OK!), or if it was completed with an error, but * did return from a pending I/O Operation and is not synchronous. */ - if (!(NT_ERROR(Irp->IoStatus.Status)) || - (NT_ERROR(Irp->IoStatus.Status) && - (Irp->PendingReturned) && - !(IsIrpSynchronous(Irp, FileObject)))) + if (!NT_ERROR(Irp->IoStatus.Status) || + (Irp->PendingReturned && + !IsIrpSynchronous(Irp, FileObject))) { /* Get any information we need from the FO before we kill it */ if ((FileObject) && (FileObject->CompletionContext)) -- 2.17.1