> -----Original Message----- > From: Zhang, Shenglei > Sent: Thursday, October 17, 2019 11:31 AM > To: devel@edk2.groups.io > Cc: Bi, Dandan <dandan...@intel.com>; Dong, Eric <eric.d...@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...@intel.com> > Cc: Eric Dong <eric.d...@intel.com> > Signed-off-by: Shenglei Zhang <shenglei.zh...@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 -=-=-=-=-=-=-=-=-=-=-=- 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: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-