]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/DirectoryManage.c
PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / DirectoryManage.c
index cae67187346903b10231643055d6c6d8f756ec19..3328ae31fed9432c282d935c73fa217d21b7d1ca 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, 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
@@ -67,7 +67,7 @@ Returns:
   }\r
 \r
   BufferSize = sizeof (FAT_DIRECTORY_ENTRY);\r
-  return FatAccessOFile (Parent, IoMode, Position, &BufferSize, Entry);\r
+  return FatAccessOFile (Parent, IoMode, Position, &BufferSize, Entry, NULL);\r
 }\r
 \r
 EFI_STATUS\r
@@ -116,7 +116,15 @@ Returns:
     // 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
@@ -349,7 +357,11 @@ Returns:
     // 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