summaryrefslogtreecommitdiffstats
path: root/FatPkg/EnhancedFatDxe/DirectoryManage.c
diff options
context:
space:
mode:
Diffstat (limited to 'FatPkg/EnhancedFatDxe/DirectoryManage.c')
-rw-r--r--FatPkg/EnhancedFatDxe/DirectoryManage.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c b/FatPkg/EnhancedFatDxe/DirectoryManage.c
index 116f87a4c2..91e7599e27 100644
--- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
+++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -116,7 +116,15 @@ Returns:
// Write LFN directory entry
//
SetMem (LfnBuffer, sizeof (CHAR16) * LFN_CHAR_TOTAL * EntryCount, 0xff);
- StrCpy (LfnBuffer, DirEnt->FileString);
+ Status = StrCpyS (
+ LfnBuffer,
+ sizeof (LfnBuffer) / sizeof (LfnBuffer[0]),
+ DirEnt->FileString
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
LfnBufferPointer = LfnBuffer;
LfnEntry.Attributes = FAT_ATTRIBUTE_LFN;
LfnEntry.Type = 0;
@@ -349,7 +357,11 @@ Returns:
// Fail to get the long file name from long file name entry,
// get the file name from short name
//
- FatGetFileNameViaCaseFlag (DirEnt, LfnBuffer);
+ FatGetFileNameViaCaseFlag (
+ DirEnt,
+ LfnBuffer,
+ sizeof (LfnBuffer) / sizeof (LfnBuffer[0])
+ );
}
DirEnt->FileString = AllocateCopyPool (StrSize (LfnBuffer), LfnBuffer);