mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[FASTFAT]
Reject more broken file names on open/create. Fixes a few kmtests:IoFilesystem tests svn path=/trunk/; revision=73923
This commit is contained in:
parent
12a5c1fb9a
commit
68b4b8905e
|
@ -398,6 +398,7 @@ VfatCreateFile(
|
||||||
BOOLEAN PagingFileCreate;
|
BOOLEAN PagingFileCreate;
|
||||||
BOOLEAN Dots;
|
BOOLEAN Dots;
|
||||||
BOOLEAN OpenTargetDir;
|
BOOLEAN OpenTargetDir;
|
||||||
|
BOOLEAN TrailingBackslash;
|
||||||
UNICODE_STRING FileNameU;
|
UNICODE_STRING FileNameU;
|
||||||
UNICODE_STRING PathNameU;
|
UNICODE_STRING PathNameU;
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
|
@ -508,6 +509,9 @@ VfatCreateFile(
|
||||||
PathNameU = FileObject->FileName;
|
PathNameU = FileObject->FileName;
|
||||||
c = PathNameU.Buffer + PathNameU.Length / sizeof(WCHAR);
|
c = PathNameU.Buffer + PathNameU.Length / sizeof(WCHAR);
|
||||||
last = c - 1;
|
last = c - 1;
|
||||||
|
|
||||||
|
TrailingBackslash = (*last == L'\\');
|
||||||
|
|
||||||
Dots = TRUE;
|
Dots = TRUE;
|
||||||
while (c-- > PathNameU.Buffer)
|
while (c-- > PathNameU.Buffer)
|
||||||
{
|
{
|
||||||
|
@ -517,6 +521,12 @@ VfatCreateFile(
|
||||||
{
|
{
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
}
|
}
|
||||||
|
if (*c == L'\\' && (c - 1) > PathNameU.Buffer &&
|
||||||
|
*(c - 1) == L'\\')
|
||||||
|
{
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
last = c - 1;
|
last = c - 1;
|
||||||
Dots = TRUE;
|
Dots = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -690,6 +700,11 @@ VfatCreateFile(
|
||||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||||
RequestedDisposition == FILE_SUPERSEDE)
|
RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
|
if (TrailingBackslash & !BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE))
|
||||||
|
{
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
||||||
if (!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE))
|
if (!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE))
|
||||||
Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||||
|
@ -780,6 +795,11 @@ VfatCreateFile(
|
||||||
VfatCloseFile (DeviceExt, FileObject);
|
VfatCloseFile (DeviceExt, FileObject);
|
||||||
return STATUS_NOT_A_DIRECTORY;
|
return STATUS_NOT_A_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
if (!vfatFCBIsDirectory(pFcb) && TrailingBackslash)
|
||||||
|
{
|
||||||
|
VfatCloseFile (DeviceExt, FileObject);
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
}
|
||||||
#ifndef USE_ROS_CC_AND_FS
|
#ifndef USE_ROS_CC_AND_FS
|
||||||
if (!vfatFCBIsDirectory(pFcb))
|
if (!vfatFCBIsDirectory(pFcb))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue