mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 13:41:24 +00:00
[FASTFAT]
- Correctly track the buffer length in VfatGetAllInformation. Fixes pool corruption when running ntdll_winetest:file svn path=/trunk/; revision=69898
This commit is contained in:
parent
187db82af7
commit
352bcdb0e1
1 changed files with 6 additions and 7 deletions
|
@ -1070,12 +1070,11 @@ VfatGetAllInformation(
|
||||||
PULONG BufferLength)
|
PULONG BufferLength)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG InitialBufferLength = *BufferLength;
|
|
||||||
|
|
||||||
ASSERT(Info);
|
ASSERT(Info);
|
||||||
ASSERT(Fcb);
|
ASSERT(Fcb);
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_ALL_INFORMATION))
|
if (*BufferLength < FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName))
|
||||||
return STATUS_BUFFER_OVERFLOW;
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
|
||||||
/* Basic Information */
|
/* Basic Information */
|
||||||
|
@ -1088,20 +1087,20 @@ VfatGetAllInformation(
|
||||||
Status = VfatGetInternalInformation(Fcb, &Info->InternalInformation, BufferLength);
|
Status = VfatGetInternalInformation(Fcb, &Info->InternalInformation, BufferLength);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
/* EA Information */
|
/* EA Information */
|
||||||
Info->EaInformation.EaSize = 0;
|
Status = VfatGetEaInformation(FileObject, Fcb, DeviceObject, &Info->EaInformation, BufferLength);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
/* Access Information: The IO-Manager adds this information */
|
/* Access Information: The IO-Manager adds this information */
|
||||||
|
*BufferLength -= sizeof(FILE_ACCESS_INFORMATION);
|
||||||
/* Position Information */
|
/* Position Information */
|
||||||
Status = VfatGetPositionInformation(FileObject, Fcb, DeviceObject, &Info->PositionInformation, BufferLength);
|
Status = VfatGetPositionInformation(FileObject, Fcb, DeviceObject, &Info->PositionInformation, BufferLength);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
/* Mode Information: The IO-Manager adds this information */
|
/* Mode Information: The IO-Manager adds this information */
|
||||||
|
*BufferLength -= sizeof(FILE_MODE_INFORMATION);
|
||||||
/* Alignment Information: The IO-Manager adds this information */
|
/* Alignment Information: The IO-Manager adds this information */
|
||||||
|
*BufferLength -= sizeof(FILE_ALIGNMENT_INFORMATION);
|
||||||
/* Name Information */
|
/* Name Information */
|
||||||
Status = VfatGetNameInformation(FileObject, Fcb, DeviceObject, &Info->NameInformation, BufferLength);
|
Status = VfatGetNameInformation(FileObject, Fcb, DeviceObject, &Info->NameInformation, BufferLength);
|
||||||
|
|
||||||
*BufferLength = InitialBufferLength - sizeof(FILE_ALL_INFORMATION);
|
|
||||||
if (InitialBufferLength > sizeof(FILE_ALL_INFORMATION))
|
|
||||||
*BufferLength -= min(InitialBufferLength - sizeof(FILE_ALL_INFORMATION), Fcb->PathNameU.Length);
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue