From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 330AA81A91 for ; Sat, 7 Jan 2017 11:19:27 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 07 Jan 2017 11:19:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,329,1477983600"; d="scan'208";a="1080328795" Received: from mdkinney-mobl.amr.corp.intel.com ([10.252.138.34]) by orsmga001.jf.intel.com with ESMTP; 07 Jan 2017 11:19:26 -0800 From: Michael Kinney To: edk2-devel@lists.01.org Cc: Ruiyu Ni , Jaben Carsey , Michael D Kinney Date: Sat, 7 Jan 2017 11:19:24 -0800 Message-Id: <1483816764-9164-1-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 Subject: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\' 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: Sat, 07 Jan 2017 19:19:27 -0000 https://bugzilla.tianocore.org/show_bug.cgi?id=331 If Nt32 is built using UEFI Shell from the ShellPkg sources, an ASSERT() is generated when a single '\' character is entered at the shell prompt. The WinNtSimpleFileSystemDxe module GetNextFileNameToken() function breaks a file path up into tokens, but it does not handle the case where a FileName ends in a '\' character. It returns an empty string instead of NULL. The fix is to set *FileName to NULL if the remaining file path is an empty string. Cc: Ruiyu Ni Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael D Kinney --- Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index 6cff2df..5bb5832 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -748,6 +748,12 @@ GetNextFileNameToken ( // Point *FileName to the next character after L'\'. // *FileName = *FileName + Offset + 1; + // + // If *FileName is an empty string, then set *FileName to NULL + // + if (**FileName == L'\0') { + *FileName = NULL; + } } return Token; -- 2.6.3.windows.1