https://git.reactos.org/?p=reactos.git;a=commitdiff;h=18d6584da443c23b1b139d6995007781b495e868

commit 18d6584da443c23b1b139d6995007781b495e868
Author: Pierre Schweitzer <[email protected]>
AuthorDate: Sat Dec 9 21:22:55 2017 +0100

    [FASTFAT] Fix FastFAT not returning short name for FAT volumes in 
FileBothDirectoryInformation case
    This is likely due to a copy paste error where long name was copied twice 
and short never.
    Fun fact: this was not affecting FATX volumes
    Fun fact2: this was defeating a buffer overflow check and thus was allowing 
buffer overflow!
    
    CORE-14088
---
 drivers/filesystems/fastfat/dir.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/filesystems/fastfat/dir.c 
b/drivers/filesystems/fastfat/dir.c
index 51359c4966..dd53080cda 100644
--- a/drivers/filesystems/fastfat/dir.c
+++ b/drivers/filesystems/fastfat/dir.c
@@ -427,9 +427,10 @@ VfatGetFileBothInformation(
         {
             pInfo->ShortNameLength = (CCHAR)DirContext->ShortNameU.Length;
 
-            RtlCopyMemory(pInfo->FileName,
-                          DirContext->LongNameU.Buffer,
-                          DirContext->LongNameU.Length);
+            ASSERT(pInfo->ShortNameLength / sizeof(WCHAR) <= 12);
+            RtlCopyMemory(pInfo->ShortName,
+                          DirContext->ShortNameU.Buffer,
+                          DirContext->ShortNameU.Length);
 
             /* pInfo->FileIndex = ; */
 

Reply via email to