public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
@ 2017-01-07 19:19 Michael Kinney
  2017-01-09 15:42 ` Carsey, Jaben
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kinney @ 2017-01-07 19:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Jaben Carsey, Michael D Kinney

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
  2017-01-07 19:19 [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\' Michael Kinney
@ 2017-01-09 15:42 ` Carsey, Jaben
  2017-01-10  1:55   ` Ni, Ruiyu
  0 siblings, 1 reply; 3+ messages in thread
From: Carsey, Jaben @ 2017-01-09 15:42 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, Carsey, Jaben

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Saturday, January 7, 2017 11:19 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
> Importance: High
> 
> 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>
> ---
>  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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
  2017-01-09 15:42 ` Carsey, Jaben
@ 2017-01-10  1:55   ` Ni, Ruiyu
  0 siblings, 0 replies; 3+ messages in thread
From: Ni, Ruiyu @ 2017-01-10  1:55 UTC (permalink / raw)
  To: Carsey, Jaben, Kinney, Michael D, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Carsey, Jaben
> Sent: Monday, January 9, 2017 11:42 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-
> devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: RE: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT()
> parsing '\'
> 
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> 
> > -----Original Message-----
> > From: Kinney, Michael D
> > Sent: Saturday, January 7, 2017 11:19 AM
> > To: edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> > <jaben.carsey@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>
> > Subject: [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing
> '\'
> > Importance: High
> >
> > 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>
> > ---
> >  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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-10  1:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-07 19:19 [Patch] Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\' Michael Kinney
2017-01-09 15:42 ` Carsey, Jaben
2017-01-10  1:55   ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox