[FASTFAT] Fix FastFAT not returning short name for FAT volumes in FileBothDirectoryIn...
authorPierre Schweitzer <pierre@reactos.org>
Sat, 9 Dec 2017 20:22:55 +0000 (21:22 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 9 Dec 2017 20:22:55 +0000 (21:22 +0100)
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

index 51359c4..dd53080 100644 (file)
@@ -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 = ; */