From 18d6584da443c23b1b139d6995007781b495e868 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 9 Dec 2017 21:22:55 +0100 Subject: [PATCH] [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 51359c49668..dd53080cdaf 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 = ; */ -- 2.17.1