From 26a31b160ab3db16bf92cc786e9d5ecf080057fe Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 6 Sep 2019 08:28:36 +0200 Subject: [PATCH] [MOUNTMGR] Fix QueryPointsFromSymbolicLinkName and make it working Select the current stack location for output buffer And set output size so that buffer gets properly copied to caller --- drivers/filters/mountmgr/point.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/filters/mountmgr/point.c b/drivers/filters/mountmgr/point.c index d63ec3a4592..77fc6fba95f 100644 --- a/drivers/filters/mountmgr/point.c +++ b/drivers/filters/mountmgr/point.c @@ -518,7 +518,7 @@ QueryPointsFromSymbolicLinkName(IN PDEVICE_EXTENSION DeviceExtension, } /* Get output buffer */ - Stack = IoGetNextIrpStackLocation(Irp); + Stack = IoGetCurrentIrpStackLocation(Irp); MountPoints = (PMOUNTMGR_MOUNT_POINTS)Irp->AssociatedIrp.SystemBuffer; /* Compute output length */ @@ -528,9 +528,12 @@ QueryPointsFromSymbolicLinkName(IN PDEVICE_EXTENSION DeviceExtension, /* Give length to allow reallocation */ MountPoints->Size = sizeof(MOUNTMGR_MOUNT_POINTS) + TotalLength; MountPoints->NumberOfMountPoints = 1; + Irp->IoStatus.Information = sizeof(MOUNTMGR_MOUNT_POINTS) + TotalLength; if (MountPoints->Size > Stack->Parameters.DeviceIoControl.OutputBufferLength) { + Irp->IoStatus.Information = sizeof(MOUNTMGR_MOUNT_POINTS); + return STATUS_BUFFER_OVERFLOW; } -- 2.17.1