From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.1957.1571283074411166873 for ; Wed, 16 Oct 2019 20:31:17 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: shenglei.zhang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 20:31:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,306,1566889200"; d="scan'208";a="208130005" Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga002.jf.intel.com with ESMTP; 16 Oct 2019 20:31:15 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Dandan Bi , Eric Dong Subject: [PATCH 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr Date: Thu, 17 Oct 2019 11:31:08 +0800 Message-Id: <20191017033110.12128-3-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20191017033110.12128-1-shenglei.zhang@intel.com> References: <20191017033110.12128-1-shenglei.zhang@intel.com> If the target string doesn't appear in the searched string, StringPtr will be NULL. So add a check for that. Cc: Dandan Bi Cc: Eric Dong Signed-off-by: Shenglei Zhang --- 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 with AltConfigHdr in AltCfgResp, ignore other which follow it. // StringPtr = StrStr (*AltCfgResp, AltConfigHdr); + if (StringPtr == NULL) { + Status = EFI_NOT_FOUND; + goto Exit; + } StringPtrNext = StrStr (StringPtr + 1, L"&GUID"); if (StringPtrNext != NULL) { TempCharA = *StringPtrNext; -- 2.18.0.windows.1