From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jim Dailey <jim_dailey@dell.com>, Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue
Date: Wed, 7 Nov 2018 17:36:37 +0800 [thread overview]
Message-ID: <20181107093637.168244-1-ruiyu.ni@intel.com> (raw)
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
next reply other threads:[~2018-11-07 9:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 9:36 Ruiyu Ni [this message]
2018-11-07 17:09 ` [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Philippe Mathieu-Daudé
2018-11-07 18:54 ` Carsey, Jaben
2018-11-08 0:46 ` Wu, Hao A
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181107093637.168244-1-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox