From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CA0C81A1E3A for ; Mon, 10 Oct 2016 01:36:21 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 10 Oct 2016 01:36:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,471,1473145200"; d="scan'208";a="18012068" Received: from shwde7156.ccr.corp.intel.com ([10.239.158.52]) by orsmga005.jf.intel.com with ESMTP; 10 Oct 2016 01:36:20 -0700 From: Eric Dong To: edk2-devel@lists.01.org Cc: Ruiyu Ni Date: Mon, 10 Oct 2016 16:36:18 +0800 Message-Id: <1476088578-77204-1-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.6.4.windows.1 Subject: [Patch] Nt32Pkg WinNtSimpleFileSystemDxe: Correct file length. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 08:36:22 -0000 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 Cc: Ruiyu Ni --- .../WinNtSimpleFileSystem.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index feef184..6cff2df 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -1,6 +1,6 @@ /**@file -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
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 @@ -1987,8 +1987,19 @@ Returns: CHAR16 *TempPointer; Size = SIZE_OF_EFI_FILE_INFO; - NameSize = StrSize (PrivateFile->FileName); - ResultSize = Size + NameSize; + + RealFileName = PrivateFile->FileName; + TempPointer = RealFileName; + while (*TempPointer) { + if (*TempPointer == '\\') { + RealFileName = TempPointer + 1; + } + + TempPointer++; + } + NameSize = StrSize (RealFileName); + + ResultSize = Size + NameSize; Status = EFI_BUFFER_TOO_SMALL; if (*BufferSize >= ResultSize) { @@ -2056,17 +2067,6 @@ Returns: Info->Attribute |= EFI_FILE_DIRECTORY; } - RealFileName = PrivateFile->FileName; - TempPointer = RealFileName; - - while (*TempPointer) { - if (*TempPointer == '\\') { - RealFileName = TempPointer + 1; - } - - TempPointer++; - } - if (PrivateFile->IsRootDirectory) { *((CHAR8 *) Buffer + Size) = 0; } else { -- 2.6.4.windows.1