https://git.reactos.org/?p=reactos.git;a=commitdiff;h=01e28771613f466046cc1…
commit 01e28771613f466046cc1caf878f5e489387c6f4
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Jun 7 19:33:23 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Thu Jun 7 19:34:47 2018 +0200
[FASTFAT] Properly check for buffer size on dir enumeration.
This avoids improper returns when multiple entries are requested
and, in rare circumstances, entries not being seen by umode.
CORE-14699
---
drivers/filesystems/fastfat/dir.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/filesystems/fastfat/dir.c b/drivers/filesystems/fastfat/dir.c
index 18c6dcc2ca..b0b442a33a 100644
--- a/drivers/filesystems/fastfat/dir.c
+++ b/drivers/filesystems/fastfat/dir.c
@@ -104,7 +104,7 @@ VfatGetFileNamesInformation(
if (FIELD_OFFSET(FILE_NAMES_INFORMATION, FileName) > BufferLength)
return Status;
- if (First || (BufferLength >= FIELD_OFFSET(FILE_NAMES_INFORMATION, FileName) +
DirContext->LongNameU.Length))
+ if (First || (BufferLength > FIELD_OFFSET(FILE_NAMES_INFORMATION, FileName) +
DirContext->LongNameU.Length))
{
pInfo->FileNameLength = DirContext->LongNameU.Length;
@@ -149,7 +149,7 @@ VfatGetFileDirectoryInformation(
if (FIELD_OFFSET(FILE_DIRECTORY_INFORMATION, FileName) > BufferLength)
return Status;
- if (First || (BufferLength >= FIELD_OFFSET(FILE_DIRECTORY_INFORMATION, FileName) +
DirContext->LongNameU.Length))
+ if (First || (BufferLength > FIELD_OFFSET(FILE_DIRECTORY_INFORMATION, FileName) +
DirContext->LongNameU.Length))
{
pInfo->FileNameLength = DirContext->LongNameU.Length;
/* pInfo->FileIndex = ; */
@@ -266,7 +266,7 @@ VfatGetFileFullDirectoryInformation(
if (FIELD_OFFSET(FILE_FULL_DIR_INFORMATION, FileName) > BufferLength)
return Status;
- if (First || (BufferLength >= FIELD_OFFSET(FILE_FULL_DIR_INFORMATION, FileName) +
DirContext->LongNameU.Length))
+ if (First || (BufferLength > FIELD_OFFSET(FILE_FULL_DIR_INFORMATION, FileName) +
DirContext->LongNameU.Length))
{
pInfo->FileNameLength = DirContext->LongNameU.Length;
/* pInfo->FileIndex = ; */
@@ -362,7 +362,7 @@ VfatGetFileBothInformation(
if (FIELD_OFFSET(FILE_BOTH_DIR_INFORMATION, FileName) > BufferLength)
return Status;
- if (First || (BufferLength >= FIELD_OFFSET(FILE_BOTH_DIR_INFORMATION, FileName) +
DirContext->LongNameU.Length))
+ if (First || (BufferLength > FIELD_OFFSET(FILE_BOTH_DIR_INFORMATION, FileName) +
DirContext->LongNameU.Length))
{
pInfo->FileNameLength = DirContext->LongNameU.Length;
pInfo->EaSize = 0;