/*++\r
\r
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
distribution. The full text of the license may be found at\r
// Write LFN directory entry\r
//\r
SetMem (LfnBuffer, sizeof (CHAR16) * LFN_CHAR_TOTAL * EntryCount, 0xff);\r
- StrCpy (LfnBuffer, DirEnt->FileString);\r
+ Status = StrCpyS (\r
+ LfnBuffer,\r
+ ARRAY_SIZE (LfnBuffer),\r
+ DirEnt->FileString\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
LfnBufferPointer = LfnBuffer;\r
LfnEntry.Attributes = FAT_ATTRIBUTE_LFN;\r
LfnEntry.Type = 0;\r
// Fail to get the long file name from long file name entry,\r
// get the file name from short name\r
//\r
- FatGetFileNameViaCaseFlag (DirEnt, LfnBuffer);\r
+ FatGetFileNameViaCaseFlag (\r
+ DirEnt,\r
+ LfnBuffer,\r
+ ARRAY_SIZE (LfnBuffer)\r
+ );\r
}\r
\r
DirEnt->FileString = AllocateCopyPool (StrSize (LfnBuffer), LfnBuffer);\r