From 462a3eba8feaf3716d294111725742ff5aa08488 Mon Sep 17 00:00:00 2001 From: Michael Kinney Date: Sat, 7 Jan 2017 11:13:32 -0800 Subject: Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\' 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 Reviewed-by: Jaben Carsey Reviewed-by: Ruiyu Ni --- Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Nt32Pkg') diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index 6cff2df053..b687e9c957 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -1,6 +1,6 @@ /**@file -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, 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 @@ -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; -- cgit v1.2.3