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

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