Commit 8e98dcd4 authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

mountmgr.sys: Use SystemBuffer output for IOCTL_STORAGE_QUERY_PROPERTY.

In METHOD_BUFFERED ioctls, SystemBuffer must be used as both the input and output buffer. Using UserBuffer directly, without any checks is dangerous and non-functional, as it will be overwritten by the contents of SystemBuffer in a correct implementation. Signed-off-by: 's avatarDerek Lesho <dlesho@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent bd97b597
......@@ -1771,12 +1771,11 @@ static void query_property( struct disk_device *device, IRP *irp )
if (device->serial) len += strlen( device->serial ) + 1;
if (!irp->UserBuffer
|| irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_DESCRIPTOR_HEADER))
if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_DESCRIPTOR_HEADER))
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER;
else if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < len)
{
descriptor = irp->UserBuffer;
descriptor = irp->AssociatedIrp.SystemBuffer;
descriptor->Version = sizeof(STORAGE_DEVICE_DESCRIPTOR);
descriptor->Size = len;
irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
......@@ -1786,8 +1785,8 @@ static void query_property( struct disk_device *device, IRP *irp )
{
FIXME( "Faking StorageDeviceProperty data\n" );
memset( irp->UserBuffer, 0, irpsp->Parameters.DeviceIoControl.OutputBufferLength );
descriptor = irp->UserBuffer;
memset( irp->AssociatedIrp.SystemBuffer, 0, irpsp->Parameters.DeviceIoControl.OutputBufferLength );
descriptor = irp->AssociatedIrp.SystemBuffer;
descriptor->Version = sizeof(STORAGE_DEVICE_DESCRIPTOR);
descriptor->Size = len;
descriptor->DeviceType = FILE_DEVICE_DISK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment