mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
sys: util: FspEaBufferAndNamesValid
This commit is contained in:
parent
91568edc45
commit
9e5d75fadc
@ -314,8 +314,7 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
return STATUS_ACCESS_DENIED;
|
||||
|
||||
/* is the EA buffer valid? */
|
||||
Irp->IoStatus.Information = 0;
|
||||
Result = IoCheckEaBufferValidity(EaBuffer, EaLength, (PULONG)&Irp->IoStatus.Information);
|
||||
Result = FspEaBufferAndNamesValid(EaBuffer, EaLength, (PULONG)&Irp->IoStatus.Information);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
}
|
||||
|
@ -515,6 +515,10 @@ NTSTATUS FspCcFlushCache(PSECTION_OBJECT_POINTERS SectionObjectPointer,
|
||||
NTSTATUS FspQuerySecurityDescriptorInfo(SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG PLength,
|
||||
PSECURITY_DESCRIPTOR ObjectsSecurityDescriptor);
|
||||
NTSTATUS FspEaBufferAndNamesValid(
|
||||
PFILE_FULL_EA_INFORMATION Buffer,
|
||||
ULONG Length,
|
||||
PULONG PErrorOffset);
|
||||
NTSTATUS FspNotifyInitializeSync(PNOTIFY_SYNC *NotifySync);
|
||||
NTSTATUS FspNotifyFullChangeDirectory(
|
||||
PNOTIFY_SYNC NotifySync,
|
||||
|
21
src/sys/ea.c
21
src/sys/ea.c
@ -506,31 +506,12 @@ static NTSTATUS FspFsvolSetEa(
|
||||
Result = FspBufferUserBuffer(Irp, Length, IoReadAccess);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Result = IoCheckEaBufferValidity(Buffer, Length,
|
||||
(PULONG)&Irp->IoStatus.Information);
|
||||
Result = FspEaBufferAndNamesValid(Buffer, Length, (PULONG)&Irp->IoStatus.Information);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
for (PFILE_FULL_EA_INFORMATION Ea = Buffer, EaEnd = (PVOID)((PUINT8)Ea + Length);
|
||||
EaEnd > Ea; Ea = FSP_NEXT_EA(Ea, EaEnd))
|
||||
{
|
||||
STRING Name;
|
||||
|
||||
Name.Length = Name.MaximumLength = Ea->EaNameLength;
|
||||
Name.Buffer = Ea->EaName;
|
||||
|
||||
if (!FspEaNameIsValid(&Name))
|
||||
{
|
||||
Result = STATUS_INVALID_EA_NAME;
|
||||
Irp->IoStatus.Information = (ULONG)((PUINT8)Ea - (PUINT8)Buffer);
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
|
||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
||||
|
||||
Result = FspIopCreateRequestEx(Irp, 0, Length, FspFsvolSetEaRequestFini,
|
||||
|
@ -49,6 +49,10 @@ NTSTATUS FspCcFlushCache(PSECTION_OBJECT_POINTERS SectionObjectPointer,
|
||||
NTSTATUS FspQuerySecurityDescriptorInfo(SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG PLength,
|
||||
PSECURITY_DESCRIPTOR ObjectsSecurityDescriptor);
|
||||
NTSTATUS FspEaBufferAndNamesValid(
|
||||
PFILE_FULL_EA_INFORMATION Buffer,
|
||||
ULONG Length,
|
||||
PULONG PErrorOffset);
|
||||
NTSTATUS FspNotifyInitializeSync(PNOTIFY_SYNC *NotifySync);
|
||||
NTSTATUS FspNotifyFullChangeDirectory(
|
||||
PNOTIFY_SYNC NotifySync,
|
||||
@ -129,6 +133,7 @@ NTSTATUS FspIrpHookNext(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context);
|
||||
#pragma alloc_text(PAGE, FspCcMdlWriteComplete)
|
||||
#pragma alloc_text(PAGE, FspCcFlushCache)
|
||||
#pragma alloc_text(PAGE, FspQuerySecurityDescriptorInfo)
|
||||
#pragma alloc_text(PAGE, FspEaBufferAndNamesValid)
|
||||
#pragma alloc_text(PAGE, FspNotifyInitializeSync)
|
||||
#pragma alloc_text(PAGE, FspNotifyFullChangeDirectory)
|
||||
#pragma alloc_text(PAGE, FspNotifyFullReportChange)
|
||||
@ -578,6 +583,39 @@ NTSTATUS FspQuerySecurityDescriptorInfo(SECURITY_INFORMATION SecurityInformation
|
||||
return STATUS_BUFFER_TOO_SMALL == Result ? STATUS_BUFFER_OVERFLOW : Result;
|
||||
}
|
||||
|
||||
NTSTATUS FspEaBufferAndNamesValid(
|
||||
PFILE_FULL_EA_INFORMATION Buffer,
|
||||
ULONG Length,
|
||||
PULONG PErrorOffset)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
NTSTATUS Result;
|
||||
|
||||
*PErrorOffset = 0;
|
||||
|
||||
Result = IoCheckEaBufferValidity(Buffer, Length, PErrorOffset);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
for (PFILE_FULL_EA_INFORMATION Ea = Buffer, EaEnd = (PVOID)((PUINT8)Ea + Length);
|
||||
EaEnd > Ea; Ea = FSP_NEXT_EA(Ea, EaEnd))
|
||||
{
|
||||
STRING Name;
|
||||
|
||||
Name.Length = Name.MaximumLength = Ea->EaNameLength;
|
||||
Name.Buffer = Ea->EaName;
|
||||
|
||||
if (!FspEaNameIsValid(&Name))
|
||||
{
|
||||
*PErrorOffset = (ULONG)((PUINT8)Ea - (PUINT8)Buffer);
|
||||
return STATUS_INVALID_EA_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS FspNotifyInitializeSync(PNOTIFY_SYNC *NotifySync)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
Loading…
x
Reference in New Issue
Block a user