1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Merge PR #666: Added Try+Except block for ProbeForRead

This commit is contained in:
Davide Beatrici 2018-08-23 04:16:05 +02:00 committed by GitHub
commit 2c9093b8eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -634,9 +634,15 @@ NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
{ {
MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); MmProbeAndLockPages(mdl, KernelMode, IoReadAccess);
} }
__try
{
ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
check_ok = false;
}
if (check_ok) {
// Write // Write
NeoWrite(buf); NeoWrite(buf);
Irp->IoStatus.Information = stack->Parameters.Write.Length; Irp->IoStatus.Information = stack->Parameters.Write.Length;
@ -651,6 +657,7 @@ NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
} }
} }
} }
}
if (ok == FALSE) if (ok == FALSE)
{ {
// An error occurred // An error occurred