mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 05:22:33 +00:00
[NPFS]
- Add more buffer checks - Clear DO_DEVICE_INITIALIZING flag svn path=/trunk/; revision=47509
This commit is contained in:
parent
f346021e6c
commit
5e80db9d5e
2 changed files with 44 additions and 8 deletions
|
@ -26,6 +26,13 @@ NpfsSetPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
PFILE_PIPE_INFORMATION Request;
|
PFILE_PIPE_INFORMATION Request;
|
||||||
DPRINT("NpfsSetPipeInformation()\n");
|
DPRINT("NpfsSetPipeInformation()\n");
|
||||||
|
|
||||||
|
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
||||||
|
{
|
||||||
|
/* Buffer too small */
|
||||||
|
return STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the Pipe and data */
|
/* Get the Pipe and data */
|
||||||
Fcb = Ccb->Fcb;
|
Fcb = Ccb->Fcb;
|
||||||
Request = (PFILE_PIPE_INFORMATION)Info;
|
Request = (PFILE_PIPE_INFORMATION)Info;
|
||||||
|
@ -63,6 +70,12 @@ NpfsSetPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
PFILE_PIPE_REMOTE_INFORMATION Request;
|
PFILE_PIPE_REMOTE_INFORMATION Request;
|
||||||
DPRINT("NpfsSetPipeRemoteInformation()\n");
|
DPRINT("NpfsSetPipeRemoteInformation()\n");
|
||||||
|
|
||||||
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
{
|
||||||
|
/* Buffer too small */
|
||||||
|
return STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the Pipe and data */
|
/* Get the Pipe and data */
|
||||||
Fcb = Ccb->Fcb;
|
Fcb = Ccb->Fcb;
|
||||||
Request = (PFILE_PIPE_REMOTE_INFORMATION)Info;
|
Request = (PFILE_PIPE_REMOTE_INFORMATION)Info;
|
||||||
|
@ -86,6 +99,13 @@ NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
ULONG ConnectionSideReadMode;
|
ULONG ConnectionSideReadMode;
|
||||||
DPRINT("NpfsQueryPipeInformation()\n");
|
DPRINT("NpfsQueryPipeInformation()\n");
|
||||||
|
|
||||||
|
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
||||||
|
{
|
||||||
|
/* Buffer too small */
|
||||||
|
*BufferLength = sizeof(FILE_PIPE_INFORMATION);
|
||||||
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the Pipe */
|
/* Get the Pipe */
|
||||||
Fcb = Ccb->Fcb;
|
Fcb = Ccb->Fcb;
|
||||||
|
|
||||||
|
@ -100,7 +120,7 @@ NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
Info->ReadMode = ConnectionSideReadMode;
|
Info->ReadMode = ConnectionSideReadMode;
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
*BufferLength -= sizeof(FILE_PIPE_INFORMATION);
|
*BufferLength = sizeof(FILE_PIPE_INFORMATION);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +134,13 @@ NpfsQueryPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
DPRINT("NpfsQueryPipeRemoteInformation()\n");
|
DPRINT("NpfsQueryPipeRemoteInformation()\n");
|
||||||
|
|
||||||
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
{
|
||||||
|
/* Buffer too small */
|
||||||
|
*BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
|
||||||
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the Pipe */
|
/* Get the Pipe */
|
||||||
Fcb = Ccb->Fcb;
|
Fcb = Ccb->Fcb;
|
||||||
|
|
||||||
|
@ -125,7 +152,7 @@ NpfsQueryPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
Info->CollectDataTime = Fcb->TimeOut;
|
Info->CollectDataTime = Fcb->TimeOut;
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
*BufferLength -= sizeof(FILE_PIPE_REMOTE_INFORMATION);
|
*BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,11 +167,21 @@ NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
DPRINT("NpfsQueryLocalPipeInformation()\n");
|
DPRINT("NpfsQueryLocalPipeInformation()\n");
|
||||||
|
|
||||||
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
{
|
||||||
|
/* Buffer too small */
|
||||||
|
*BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
|
||||||
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the Pipe */
|
||||||
Fcb = Ccb->Fcb;
|
Fcb = Ccb->Fcb;
|
||||||
|
|
||||||
|
/* Clear Info */
|
||||||
RtlZeroMemory(Info,
|
RtlZeroMemory(Info,
|
||||||
sizeof(FILE_PIPE_LOCAL_INFORMATION));
|
sizeof(FILE_PIPE_LOCAL_INFORMATION));
|
||||||
|
|
||||||
|
/* Return Info */
|
||||||
Info->NamedPipeType = Fcb->PipeType;
|
Info->NamedPipeType = Fcb->PipeType;
|
||||||
Info->NamedPipeConfiguration = Fcb->PipeConfiguration;
|
Info->NamedPipeConfiguration = Fcb->PipeConfiguration;
|
||||||
Info->MaximumInstances = Fcb->MaximumInstances;
|
Info->MaximumInstances = Fcb->MaximumInstances;
|
||||||
|
@ -165,7 +202,7 @@ NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
Info->WriteQuotaAvailable = Ccb->OtherSide->WriteQuotaAvailable;
|
Info->WriteQuotaAvailable = Ccb->OtherSide->WriteQuotaAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
|
*BufferLength = sizeof(FILE_PIPE_LOCAL_INFORMATION);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,14 +263,12 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
|
BufferLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
if (NT_SUCCESS(Status))
|
Irp->IoStatus.Information = BufferLength;
|
||||||
Irp->IoStatus.Information =
|
|
||||||
IoStack->Parameters.QueryFile.Length - BufferLength;
|
|
||||||
else
|
|
||||||
Irp->IoStatus.Information = 0;
|
|
||||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -70,6 +70,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* initialize the device object */
|
/* initialize the device object */
|
||||||
DeviceObject->Flags |= DO_DIRECT_IO;
|
DeviceObject->Flags |= DO_DIRECT_IO;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
/* initialize the device extension */
|
/* initialize the device extension */
|
||||||
DeviceExtension = DeviceObject->DeviceExtension;
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue