> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:31 AM
> To: [email protected]
> Cc: Bi, Dandan <[email protected]>; Dong, Eric <[email protected]>
> 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 <[email protected]>
> Cc: Eric Dong <[email protected]>
> Signed-off-by: Shenglei Zhang <[email protected]>
> ---
> 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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#49176): https://edk2.groups.io/g/devel/message/49176
Mute This Topic: https://groups.io/mt/34668864/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-