mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[FASTFAT] When dealing with attributes on IRP_MJ_CREATE, filter user input to ensure we have only attributes we can handle.
This applies to files newly created, or for files overwritten where attributes are reset/modified.
This commit is contained in:
parent
7bea4ec07e
commit
0eacb0b1ef
1 changed files with 8 additions and 4 deletions
|
@ -728,7 +728,11 @@ VfatCreateFile(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
Attributes = (Stack->Parameters.Create.FileAttributes & (FILE_ATTRIBUTE_ARCHIVE |
|
||||||
|
FILE_ATTRIBUTE_SYSTEM |
|
||||||
|
FILE_ATTRIBUTE_HIDDEN |
|
||||||
|
FILE_ATTRIBUTE_DIRECTORY |
|
||||||
|
FILE_ATTRIBUTE_READONLY));
|
||||||
|
|
||||||
/* If the file open failed then create the required file */
|
/* If the file open failed then create the required file */
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
|
@ -750,7 +754,7 @@ VfatCreateFile(
|
||||||
}
|
}
|
||||||
vfatSplitPathName(&PathNameU, NULL, &FileNameU);
|
vfatSplitPathName(&PathNameU, NULL, &FileNameU);
|
||||||
Status = VfatAddEntry(DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions,
|
Status = VfatAddEntry(DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions,
|
||||||
(UCHAR)FlagOn(Attributes, FILE_ATTRIBUTE_VALID_FLAGS), NULL);
|
Attributes, NULL);
|
||||||
vfatReleaseFCB(DeviceExt, ParentFcb);
|
vfatReleaseFCB(DeviceExt, ParentFcb);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -921,11 +925,11 @@ VfatCreateFile(
|
||||||
{
|
{
|
||||||
if (RequestedDisposition == FILE_SUPERSEDE)
|
if (RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
*pFcb->Attributes = Attributes & ~FILE_ATTRIBUTE_NORMAL;
|
*pFcb->Attributes = Attributes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pFcb->Attributes |= Attributes & ~FILE_ATTRIBUTE_NORMAL;
|
*pFcb->Attributes |= Attributes;
|
||||||
}
|
}
|
||||||
*pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
*pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||||
VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
|
VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
|
||||||
|
|
Loading…
Reference in a new issue