public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/Shell: Avoid potential null pointer deference
@ 2017-03-28  2:27 Ruiyu Ni
  2017-03-28  3:09 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-03-28  2:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao A Wu

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
 ShellPkg/Application/Shell/Shell.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index dfcbfb8..af8e523 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -1162,6 +1162,12 @@ LocateStartupScript (
   MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath (&ImageDevicePath);
   if (MapName != NULL) {   
     StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0);
+    if (StartupScriptPath == NULL) {
+      //
+      // Do not locate the startup script in sys path when out of resource.
+      //
+      return NULL;
+    }
     TempSpot = StrStr (StartupScriptPath, L";");
     if (TempSpot != NULL) {
       *TempSpot = CHAR_NULL;
-- 
2.9.0.windows.1



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

* Re: [PATCH] ShellPkg/Shell: Avoid potential null pointer deference
  2017-03-28  2:27 [PATCH] ShellPkg/Shell: Avoid potential null pointer deference Ruiyu Ni
@ 2017-03-28  3:09 ` Wu, Hao A
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2017-03-28  3:09 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org

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

Best Regards,
Hao Wu


> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Tuesday, March 28, 2017 10:27 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A
> Subject: [PATCH] ShellPkg/Shell: Avoid potential null pointer deference
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> ---
>  ShellPkg/Application/Shell/Shell.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/ShellPkg/Application/Shell/Shell.c
> b/ShellPkg/Application/Shell/Shell.c
> index dfcbfb8..af8e523 100644
> --- a/ShellPkg/Application/Shell/Shell.c
> +++ b/ShellPkg/Application/Shell/Shell.c
> @@ -1162,6 +1162,12 @@ LocateStartupScript (
>    MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath
> (&ImageDevicePath);
>    if (MapName != NULL) {
>      StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0);
> +    if (StartupScriptPath == NULL) {
> +      //
> +      // Do not locate the startup script in sys path when out of resource.
> +      //
> +      return NULL;
> +    }
>      TempSpot = StrStr (StartupScriptPath, L";");
>      if (TempSpot != NULL) {
>        *TempSpot = CHAR_NULL;
> --
> 2.9.0.windows.1



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

end of thread, other threads:[~2017-03-28  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-28  2:27 [PATCH] ShellPkg/Shell: Avoid potential null pointer deference Ruiyu Ni
2017-03-28  3:09 ` 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