From: "Dandan Bi" <dandan.bi@intel.com>
To: "Zhang, Shenglei" <shenglei.zhang@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [PATCH 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr
Date: Thu, 17 Oct 2019 08:41:50 +0000 [thread overview]
Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40C7A1B9@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20191017033110.12128-3-shenglei.zhang@intel.com>
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:31 AM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: [PATCH 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for
> StringPtr
>
> If the target string doesn't appear in the searched string, StringPtr will be
> NULL. So add a check for that.
>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> index 71ea25bc19bf..f786da8e370a 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> @@ -909,6 +909,10 @@ CompareAndMergeDefaultString (
> // To find the <AltResp> with AltConfigHdr in AltCfgResp, ignore other
> <AltResp> which follow it.
> //
> StringPtr = StrStr (*AltCfgResp, AltConfigHdr);
> + if (StringPtr == NULL) {
> + Status = EFI_NOT_FOUND;
> + goto Exit;
> + }
Hi Shenglei,
I think we can add ASSERT (StringPtr != NULL); here.
Since when call this function, the AltCfgResp and DefaultAltCfgResp must have contained the AltConfigHdr.
The caller of the CompareAndMergeDefaultString have done the check.
Thanks,
Dandan
> StringPtrNext = StrStr (StringPtr + 1, L"&GUID");
> if (StringPtrNext != NULL) {
> TempCharA = *StringPtrNext;
> --
> 2.18.0.windows.1
next prev parent reply other threads:[~2019-10-17 8:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 3:31 [PATCH 0/4] MdeModulePkg: Add check for variables and return value Zhang, Shenglei
2019-10-17 3:31 ` [PATCH 1/4] MdeModulePkg/EbcDebugger: Add check for Entry and RetEntry Zhang, Shenglei
2019-10-30 7:00 ` Wu, Hao A
2019-10-17 3:31 ` [PATCH 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr Zhang, Shenglei
2019-10-17 8:41 ` Dandan Bi [this message]
2019-10-17 3:31 ` [PATCH 3/4] MdeModulePkg/EsrtDxe: Add check for EsrtRepository Zhang, Shenglei
2019-10-30 7:01 ` Wu, Hao A
2019-10-17 3:31 ` [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue() Zhang, Shenglei
2019-10-30 7:01 ` 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=3C0D5C461C9E904E8F62152F6274C0BB40C7A1B9@SHSMSX104.ccr.corp.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