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>
This commit is contained in:
Michael Kinney 2017-01-07 11:13:32 -08:00
parent 0f705029d9
commit 462a3eba8f
1 changed files with 7 additions and 1 deletions

View File

@ -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;