mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 17:32:29 -05:00
sys: IRP_MJ_CREATE: check for trailing backslash after FileNode->FileName generation
This commit is contained in:
parent
0ebb8c620c
commit
96c1e786f4
@ -168,20 +168,6 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for trailing backslash */
|
|
||||||
if (sizeof(WCHAR) * 2/* not empty or root */ <= FileName.Length &&
|
|
||||||
L'\\' == FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1])
|
|
||||||
{
|
|
||||||
FileName.Length -= sizeof(WCHAR);
|
|
||||||
HasTrailingBackslash = TRUE;
|
|
||||||
|
|
||||||
if (sizeof(WCHAR) * 2 <= FileName.Length &&
|
|
||||||
L'\\' == FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1])
|
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
|
||||||
}
|
|
||||||
if (HasTrailingBackslash && !FlagOn(CreateOptions, FILE_DIRECTORY_FILE))
|
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
|
||||||
|
|
||||||
/* is this a relative or absolute open? */
|
/* is this a relative or absolute open? */
|
||||||
if (0 != RelatedFileObject)
|
if (0 != RelatedFileObject)
|
||||||
{
|
{
|
||||||
@ -279,6 +265,26 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
FileNode->FileName.Buffer += FsvolDeviceExtension->VolumePrefix.Length / sizeof(WCHAR);
|
FileNode->FileName.Buffer += FsvolDeviceExtension->VolumePrefix.Length / sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check for trailing backslash */
|
||||||
|
if (sizeof(WCHAR) * 2/* not empty or root */ <= FileNode->FileName.Length &&
|
||||||
|
L'\\' == FileNode->FileName.Buffer[FileNode->FileName.Length / sizeof(WCHAR) - 1])
|
||||||
|
{
|
||||||
|
FileNode->FileName.Length -= sizeof(WCHAR);
|
||||||
|
HasTrailingBackslash = TRUE;
|
||||||
|
|
||||||
|
if (sizeof(WCHAR) * 2 <= FileNode->FileName.Length &&
|
||||||
|
L'\\' == FileNode->FileName.Buffer[FileNode->FileName.Length / sizeof(WCHAR) - 1])
|
||||||
|
{
|
||||||
|
FspFileNodeDereference(FileNode);
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (HasTrailingBackslash && !FlagOn(CreateOptions, FILE_DIRECTORY_FILE))
|
||||||
|
{
|
||||||
|
FspFileNodeDereference(FileNode);
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
Result = FspFileDescCreate(&FileDesc);
|
Result = FspFileDescCreate(&FileDesc);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user