]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
authorMichael Kinney <michael.d.kinney@intel.com>
Sat, 7 Jan 2017 19:13:32 +0000 (11:13 -0800)
committerMichael Kinney <michael.d.kinney@intel.com>
Tue, 10 Jan 2017 20:35:39 +0000 (12:35 -0800)
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>
Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c

index 6cff2df0530ec0cfcc09c63a4d8a73f981439030..b687e9c95746fd644dd6c4e017e85fb51e8fba36 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -748,6 +748,12 @@ GetNextFileNameToken (
     // Point *FileName to the next character after L'\'.\r
     //\r
     *FileName = *FileName + Offset + 1;\r
+    //\r
+    // If *FileName is an empty string, then set *FileName to NULL\r
+    //\r
+    if (**FileName == L'\0') {\r
+      *FileName = NULL;\r
+    }\r
   }\r
 \r
   return Token;\r