]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Nt32Pkg WinNtSimpleFileSystemDxe: Correct file length.
authorDong, Eric <eric.dong@intel.com>
Mon, 10 Oct 2016 08:36:18 +0000 (16:36 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 11 Oct 2016 02:17:25 +0000 (10:17 +0800)
In GetInfo interface, current code copy real file name buffer
with full path file length. It should use real file name
length. This patch fix this error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c

index feef184edb2b02d3d5a45811147093e75c9b160e..6cff2df0530ec0cfcc09c63a4d8a73f981439030 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1987,8 +1987,19 @@ Returns:
   CHAR16                      *TempPointer;\r
 \r
   Size        = SIZE_OF_EFI_FILE_INFO;\r
-  NameSize    = StrSize (PrivateFile->FileName);\r
-  ResultSize  = Size + NameSize;\r
+\r
+  RealFileName  = PrivateFile->FileName;\r
+  TempPointer   = RealFileName;\r
+  while (*TempPointer) {\r
+    if (*TempPointer == '\\') {\r
+      RealFileName = TempPointer + 1;\r
+    }\r
+\r
+    TempPointer++;\r
+  }\r
+  NameSize = StrSize (RealFileName);\r
+\r
+  ResultSize = Size + NameSize; \r
 \r
   Status      = EFI_BUFFER_TOO_SMALL;\r
   if (*BufferSize >= ResultSize) {\r
@@ -2056,17 +2067,6 @@ Returns:
       Info->Attribute |= EFI_FILE_DIRECTORY;\r
     }\r
 \r
-    RealFileName  = PrivateFile->FileName;\r
-    TempPointer   = RealFileName;\r
-\r
-    while (*TempPointer) {\r
-      if (*TempPointer == '\\') {\r
-        RealFileName = TempPointer + 1;\r
-      }\r
-\r
-      TempPointer++;\r
-    }\r
-\r
     if (PrivateFile->IsRootDirectory) {\r
       *((CHAR8 *) Buffer + Size) = 0;\r
     } else {\r