From a53818114054251428a7c9cc1c728f55f0f07e41 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 4 Jun 2017 16:59:25 +0000 Subject: [PATCH] [UDFS] Fix broken implementation of UDFGetFullNameInformation(). Always return full name length so that caller can allocate a big-enough buffer for later call. CORE-4375 svn path=/trunk/; revision=74914 --- reactos/drivers/filesystems/udfs/fileinfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/filesystems/udfs/fileinfo.cpp b/reactos/drivers/filesystems/udfs/fileinfo.cpp index a4dadded40f..fa6b3e1ae20 100644 --- a/reactos/drivers/filesystems/udfs/fileinfo.cpp +++ b/reactos/drivers/filesystems/udfs/fileinfo.cpp @@ -831,20 +831,22 @@ UDFGetFullNameInformation( IN OUT PLONG PtrReturnedLength ) { + ULONG BytesToCopy; NTSTATUS RC = STATUS_SUCCESS; AdPrint(("UDFGetFullNameInformation\n")); PtrBuffer->FileNameLength = FileObject->FileName.Length; + BytesToCopy = FileObject->FileName.Length; if (PtrBuffer->FileNameLength + sizeof( ULONG ) > (ULONG)(*PtrReturnedLength)) { - PtrBuffer->FileNameLength = *PtrReturnedLength - sizeof( ULONG ); + BytesToCopy = *PtrReturnedLength - sizeof( ULONG ); RC = STATUS_BUFFER_OVERFLOW; } - RtlCopyMemory( PtrBuffer->FileName, FileObject->FileName.Buffer, PtrBuffer->FileNameLength ); + RtlCopyMemory( PtrBuffer->FileName, FileObject->FileName.Buffer, BytesToCopy ); // Reduce the available bytes by the amount stored into this buffer. *PtrReturnedLength -= sizeof( ULONG ) + PtrBuffer->FileNameLength;