summaryrefslogtreecommitdiffstats
path: root/Nt32Pkg
diff options
context:
space:
mode:
authorMichael Kinney <michael.d.kinney@intel.com>2017-01-07 11:13:32 -0800
committerMichael Kinney <michael.d.kinney@intel.com>2017-01-10 12:35:39 -0800
commit462a3eba8feaf3716d294111725742ff5aa08488 (patch)
treec7a6c24e6a8aedaa399eb949402052c1a8f49f7f /Nt32Pkg
parent0f705029d91559030bfa5f505daca57dcefd1a2e (diff)
downloadedk2-462a3eba8feaf3716d294111725742ff5aa08488.tar.gz
edk2-462a3eba8feaf3716d294111725742ff5aa08488.tar.bz2
edk2-462a3eba8feaf3716d294111725742ff5aa08488.zip
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 <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c8
1 files changed, 7 insertions, 1 deletions
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.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
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;