public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
@ 2018-11-07  9:36 Ruiyu Ni
  2018-11-07 17:09 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ruiyu Ni @ 2018-11-07  9:36 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jim Dailey, Hao A Wu

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jim Dailey <jim_dailey@dell.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 580a1ee612..b17266d623 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -72,6 +72,7 @@ FullyQualifyPath(
 {
   CONST CHAR16         *WorkingPath;
   CONST CHAR16         *InputPath;
+  CHAR16               *CharPtr;
   CHAR16               *InputFileSystem;
   UINTN                FileSystemCharCount;
   CHAR16               *FullyQualifiedPath;
@@ -131,7 +132,10 @@ FullyQualifyPath(
         // truncate the new path after the file system part.
         //
         StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
-        *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
+        CharPtr = StrStr(FullyQualifiedPath, L":");
+        if (CharPtr != NULL) {
+          *(CharPtr + 1) = CHAR_NULL;
+        }
       } else {
         //
         // Relative path: start with the working directory and append "\".
-- 
2.16.1.windows.1



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

* Re: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
  2018-11-07  9:36 [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Ruiyu Ni
@ 2018-11-07 17:09 ` Philippe Mathieu-Daudé
  2018-11-07 18:54 ` Carsey, Jaben
  2018-11-08  0:46 ` Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-07 17:09 UTC (permalink / raw)
  To: Ruiyu Ni, edk2-devel; +Cc: Hao A Wu, Jim Dailey

On 7/11/18 10:36, Ruiyu Ni wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jim Dailey <jim_dailey@dell.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 580a1ee612..b17266d623 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -72,6 +72,7 @@ FullyQualifyPath(
>   {
>     CONST CHAR16         *WorkingPath;
>     CONST CHAR16         *InputPath;
> +  CHAR16               *CharPtr;
>     CHAR16               *InputFileSystem;
>     UINTN                FileSystemCharCount;
>     CHAR16               *FullyQualifiedPath;
> @@ -131,7 +132,10 @@ FullyQualifyPath(
>           // truncate the new path after the file system part.
>           //
>           StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> -        *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
> +        CharPtr = StrStr(FullyQualifiedPath, L":");
> +        if (CharPtr != NULL) {
> +          *(CharPtr + 1) = CHAR_NULL;
> +        }
>         } else {
>           //
>           // Relative path: start with the working directory and append "\".
> 


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

* Re: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
  2018-11-07  9:36 [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Ruiyu Ni
  2018-11-07 17:09 ` Philippe Mathieu-Daudé
@ 2018-11-07 18:54 ` Carsey, Jaben
  2018-11-08  0:46 ` Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Carsey, Jaben @ 2018-11-07 18:54 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Wu, Hao A, Jim Dailey

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

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Wednesday, November 07, 2018 1:37 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Jim Dailey <jim_dailey@dell.com>
> Subject: [edk2] [PATCH] ShellPkg/ShellLib: Fix potential NULL deference
> issue
> Importance: High
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jim Dailey <jim_dailey@dell.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> ---
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 580a1ee612..b17266d623 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -72,6 +72,7 @@ FullyQualifyPath(
>  {
>    CONST CHAR16         *WorkingPath;
>    CONST CHAR16         *InputPath;
> +  CHAR16               *CharPtr;
>    CHAR16               *InputFileSystem;
>    UINTN                FileSystemCharCount;
>    CHAR16               *FullyQualifiedPath;
> @@ -131,7 +132,10 @@ FullyQualifyPath(
>          // truncate the new path after the file system part.
>          //
>          StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> -        *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
> +        CharPtr = StrStr(FullyQualifiedPath, L":");
> +        if (CharPtr != NULL) {
> +          *(CharPtr + 1) = CHAR_NULL;
> +        }
>        } else {
>          //
>          // Relative path: start with the working directory and append "\".
> --
> 2.16.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
  2018-11-07  9:36 [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Ruiyu Ni
  2018-11-07 17:09 ` Philippe Mathieu-Daudé
  2018-11-07 18:54 ` Carsey, Jaben
@ 2018-11-08  0:46 ` Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Wu, Hao A @ 2018-11-08  0:46 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Jim Dailey

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Wednesday, November 07, 2018 5:37 PM
> To: edk2-devel@lists.01.org
> Cc: Jim Dailey; Wu, Hao A
> Subject: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jim Dailey <jim_dailey@dell.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> ---
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 580a1ee612..b17266d623 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -72,6 +72,7 @@ FullyQualifyPath(
>  {
>    CONST CHAR16         *WorkingPath;
>    CONST CHAR16         *InputPath;
> +  CHAR16               *CharPtr;
>    CHAR16               *InputFileSystem;
>    UINTN                FileSystemCharCount;
>    CHAR16               *FullyQualifiedPath;
> @@ -131,7 +132,10 @@ FullyQualifyPath(
>          // truncate the new path after the file system part.
>          //
>          StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> -        *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
> +        CharPtr = StrStr(FullyQualifiedPath, L":");
> +        if (CharPtr != NULL) {
> +          *(CharPtr + 1) = CHAR_NULL;
> +        }
>        } else {
>          //
>          // Relative path: start with the working directory and append "\".
> --

Reviewed-by: Hao Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

> 2.16.1.windows.1



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

end of thread, other threads:[~2018-11-08  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07  9:36 [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Ruiyu Ni
2018-11-07 17:09 ` Philippe Mathieu-Daudé
2018-11-07 18:54 ` Carsey, Jaben
2018-11-08  0:46 ` Wu, Hao A

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