[NTOS:IO] Fix IRP stack location check in IoForwardIrpSynchronously

We are doing IoCallDriver here, so the valid stack location should be
CurrentLocation <= Irp->StackCount (just a check for a completly incorrect value)
&& CurrentLocation > 1 (ensure that we have a place for another call)

CORE-17189

Co-authored-by: Thomas Faber <thomas.faber@reactos.org>
This commit is contained in:
Victor Perevertkin 2020-09-07 04:57:17 +03:00
parent 8fa3c147b6
commit f562f9c5c6
No known key found for this signature in database
GPG key ID: C750B7222E9C7830

View file

@ -1629,7 +1629,7 @@ IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject,
NTSTATUS Status;
/* Check if next stack location is available */
if (Irp->CurrentLocation < Irp->StackCount)
if (Irp->CurrentLocation > Irp->StackCount || Irp->CurrentLocation <= 1)
{
/* No more stack location */
return FALSE;