From e95751ab786e0266f430e6f65218835774d328d9 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 9 Dec 2017 10:59:37 +0100 Subject: [PATCH] [FASTFAT] Calculate more accurately buffer length in VfatGetAllInformation(). --- drivers/filesystems/fastfat/finfo.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/filesystems/fastfat/finfo.c b/drivers/filesystems/fastfat/finfo.c index 766a4f38ee5..03b7d3cc93b 100644 --- a/drivers/filesystems/fastfat/finfo.c +++ b/drivers/filesystems/fastfat/finfo.c @@ -1188,6 +1188,8 @@ VfatGetAllInformation( if (*BufferLength < FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName)) return STATUS_BUFFER_OVERFLOW; + *BufferLength -= (sizeof(FILE_ACCESS_INFORMATION) + sizeof(FILE_MODE_INFORMATION) + sizeof(FILE_ALIGNMENT_INFORMATION)); + /* Basic Information */ Status = VfatGetBasicInformation(FileObject, Fcb, DeviceExt, &Info->BasicInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; @@ -1200,15 +1202,9 @@ VfatGetAllInformation( /* EA Information */ Status = VfatGetEaInformation(FileObject, Fcb, DeviceExt, &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, DeviceExt, &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, DeviceExt, &Info->NameInformation, BufferLength); -- 2.17.1