From 352bcdb0e1a7396ffbc9d7640b17829154f709f3 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Mon, 16 Nov 2015 13:58:39 +0000 Subject: [PATCH] [FASTFAT] - Correctly track the buffer length in VfatGetAllInformation. Fixes pool corruption when running ntdll_winetest:file svn path=/trunk/; revision=69898 --- reactos/drivers/filesystems/fastfat/finfo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index d4ddcc8b2ba..a7e61713fc6 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -1070,12 +1070,11 @@ VfatGetAllInformation( PULONG BufferLength) { NTSTATUS Status; - ULONG InitialBufferLength = *BufferLength; ASSERT(Info); ASSERT(Fcb); - if (*BufferLength < sizeof(FILE_ALL_INFORMATION)) + if (*BufferLength < FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName)) return STATUS_BUFFER_OVERFLOW; /* Basic Information */ @@ -1088,20 +1087,20 @@ VfatGetAllInformation( Status = VfatGetInternalInformation(Fcb, &Info->InternalInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* 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 */ + *BufferLength -= sizeof(FILE_ACCESS_INFORMATION); /* Position Information */ Status = VfatGetPositionInformation(FileObject, Fcb, DeviceObject, &Info->PositionInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* Mode Information: The IO-Manager adds this information */ + *BufferLength -= sizeof(FILE_MODE_INFORMATION); /* Alignment Information: The IO-Manager adds this information */ + *BufferLength -= sizeof(FILE_ALIGNMENT_INFORMATION); /* Name Information */ 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; } -- 2.17.1