From nobody Sun Feb 8 10:21:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42942+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42942+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1561652795; cv=none; d=zoho.com; s=zohoarc; b=nvy9EipMWXaRpG2WVUF2ABHdl273bLp6EOqWChBs6+uSaSQfE8AFiPdHnnknJ8BCghntxWX2JmfGVhGqqMrqtkutCLIZ8LstTz3+0pYG1jxTSG09Atexvd3szbaH9dQvz/XWov4SlbnICmKaneM28xKX6CqNbOhpnU+dtYxiUkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561652795; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=yrv/02tPai00ZOeBiw5Qp4KciJGhNqQQEXrZYT8r144=; b=jYKOVbf4lX+niImRk1kfJy7A0MaYHcJj0IOuL3idpGz4XfW8U+UkDbN10XaP0mcQca2RaTy4rNu9r2Sm/Q2kCQye0x4M87ICW89HjFEMlBNhDmC3gOUUw2y/riuDyin/7AM5YzxSWt3Yzk8ulseVv9bIcxkHtkt1Pw3jxokBN9Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42942+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1561652795990265.69812202129333; Thu, 27 Jun 2019 09:26:35 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Thu, 27 Jun 2019 09:26:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2019 09:26:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,424,1557212400"; d="scan'208";a="153094516" X-Received: from shwdeopenpsi174.ccr.corp.intel.com ([10.239.157.39]) by orsmga007.jf.intel.com with ESMTP; 27 Jun 2019 09:26:32 -0700 From: "Xu, Wei6" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Chao B Zhang Subject: [edk2-devel][Patch] MdeModulePkg/DxeCapsuleLibFmp: Add missing NULL pointer check. Date: Fri, 28 Jun 2019 00:26:29 +0800 Message-Id: <20190627162629.16352-1-wei6.xu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wei6.xu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1561652794; bh=154auXoHIaUAi15ruSj1MM7/E5KzMtzK5V/gHXOHvt4=; h=Cc:Date:From:Reply-To:Subject:To; b=H7FUPNpclRykoOfCTZekwPJ2F9ASrl/uplSl0kgTl32pP0pQDj3eszZCuFFZgoUrNcK Q2PrfGS43W4m2aTOmKH74AFdsx1WPVWdhCuEqsfo99UNqbzZxeYKOQkt6Nc3hEfCTgruL J91qWcJ2RUReSH8/s6bKtn1poGpIev9n/i4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add missing NULL pointer check for CapsuleNameBufStart. Also add comments to notice that capsule name integrity check assumes the capsule has been validated by IsValidCapsuleHeader(). Cc: Jian J Wang Cc: Hao A Wu Cc: Chao B Zhang Signed-off-by: Wei6 Xu Reviewed-by: Chao Zhang Reviewed-by: Hao A Wu > Reviewed-by: Hao A Wu --- MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c b/MdeMod= ulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c index 66c9be8e1f..3193ca8f4d 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c @@ -23,10 +23,13 @@ IsCapsuleNameCapsule ( =20 /** Check the integrity of the capsule name capsule. If the capsule is vaild, return the physical address of each capsule nam= e string. =20 + This routine assumes the capsule has been validated by IsValidCapsuleHea= der(), so + capsule memory overflow is not going to happen in this routine. + @param[in] CapsuleHeader Pointer to the capsule header of a capsule n= ame capsule. @param[out] CapsuleNameNum Number of capsule name. =20 @retval NULL Capsule name capsule is not valid. @retval CapsuleNameBuf Array of capsule name physical address. @@ -63,10 +66,13 @@ ValidateCapsuleNameCapsuleIntegrity ( // // If strings are not aligned on a 16-bit boundary, reallocate memory fo= r it. // if (((UINTN) CapsuleNameBufStart & BIT0) !=3D 0) { CapsuleNameBufStart =3D AllocateCopyPool (CapsuleHeader->CapsuleImageS= ize - CapsuleHeader->HeaderSize, CapsuleNameBufStart); + if (CapsuleNameBufStart =3D=3D NULL) { + return NULL; + } } =20 CapsuleNameBufEnd =3D CapsuleNameBufStart + CapsuleHeader->CapsuleImageS= ize - CapsuleHeader->HeaderSize; =20 CapsuleNamePtr =3D CapsuleNameBufStart; --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42942): https://edk2.groups.io/g/devel/message/42942 Mute This Topic: https://groups.io/mt/32232931/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-