From nobody Wed May 8 22:48:49 2024 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+43712+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+43712+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563175862; cv=none; d=zoho.com; s=zohoarc; b=GoEQAwyBOTNpYC1/s4PtqG2vxFPuvWu7nc1UOLozj7M7mZCm83V0nC+JGIBM0XsxZma/FaRsnXYlBM7cIiykZhJoqEJUipgseQwPaM4lKhugfJDWJQyXkZpLSBq3wqD6Ma1NzfHdFZJX1sHgjH8o78HPJy1lxgflnec/0uTHGNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563175862; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=uzqOhqGMKYVWNcLf74FXsUY8C5shKJjB+vcTSoYu/4g=; b=hwSbbGlsP00cv3Fbk6sYKWTW1fomo8n2SRqJmPrq6ui5R5jkq5O8W8pH0u6aEXlflVs/sekXcS6vU/EJIkmZG61oTJDjzMKqGp5/9Ag9Z5KTIwJiNxZ6gEyOL03m4GXGprIkRZeF8S4NtlwMp/BLTuNidHPhmmydN3QDz7+1V0U= 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+43712+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 156317586258412.484923683404304; Mon, 15 Jul 2019 00:31:02 -0700 (PDT) Return-Path: X-Received: from mga05.intel.com (mga05.intel.com []) by groups.io with SMTP; Mon, 15 Jul 2019 00:31:01 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jul 2019 00:31:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,493,1557212400"; d="scan'208";a="187064424" X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 15 Jul 2019 00:31:00 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jaben Carsey , Ray Ni , Andrew Fish Subject: [edk2-devel] [PATCH] ShellPkg/UefiHandleParsingLib: Fix error allocate pool Date: Mon, 15 Jul 2019 15:30:06 +0800 Message-Id: <20190715073007.25732-3-zhichao.gao@intel.com> In-Reply-To: <20190715073007.25732-1-zhichao.gao@intel.com> References: <20190715073007.25732-1-zhichao.gao@intel.com> MIME-Version: 1.0 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,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563175862; bh=NninPUFijAYD1J1B3OUeETTwx1WnwMWXUfg7mE8r1v8=; h=Cc:Date:From:Reply-To:Subject:To; b=CewdEEq/eSH6JyBNtRm4DMWA4/pR4c7wvvRhQWxuZpQvTBAPnaLvGZ7KBkF90lgTC4K mAcYhez+ewt7Hbf0Wh8f/BLJ6IVYOnXxwYHtXnbPzclJjMYVvEGUA///E3YlqvjjQ/QT8 wD/+uyXNLEhx1r5kDihel82/9zpDIeynzEw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1965 For function InsertNewGuidNameMapping, it rellocate the mGuidList with new size "mGuidListCount+1 * sizeof(GUID_INFO_BLOCK)". That isn't its purpose and would cause a overflow operation in "mGuidList[mGuidListCount - 1].xxx =3D xxx". Its purpose is to increase 1 block size of mGuidList. Change it to "(mGuidListCount + 1) * sizeof (GUID_INFO_BLOCK)". Adjust the coding style of this function. Cc: Jaben Carsey Cc: Ray Ni Cc: Andrew Fish Signed-off-by: Zhichao Gao --- .../UefiHandleParsingLib/UefiHandleParsingLib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b= /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index f179c41092..430c0ee70b 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -2462,17 +2462,21 @@ InsertNewGuidNameMapping( IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL ) { - ASSERT(Guid !=3D NULL); - ASSERT(NameID !=3D 0); + ASSERT (Guid !=3D NULL); + ASSERT (NameID !=3D 0); =20 - mGuidList =3D ReallocatePool(mGuidListCount * sizeof(GUID_INFO_BLOCK), m= GuidListCount+1 * sizeof(GUID_INFO_BLOCK), mGuidList); + mGuidList =3D ReallocatePool ( + mGuidListCount * sizeof (GUID_INFO_BLOCK), + (mGuidListCount + 1) * sizeof (GUID_INFO_BLOCK), + mGuidList + ); if (mGuidList =3D=3D NULL) { mGuidListCount =3D 0; return (EFI_OUT_OF_RESOURCES); } mGuidListCount++; =20 - mGuidList[mGuidListCount - 1].GuidId =3D AllocateCopyPool(sizeof(EFI_G= UID), Guid); + mGuidList[mGuidListCount - 1].GuidId =3D AllocateCopyPool (sizeof (EFI= _GUID), Guid); mGuidList[mGuidListCount - 1].StringId =3D NameID; mGuidList[mGuidListCount - 1].DumpInfo =3D DumpFunc; =20 --=20 2.21.0.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 (#43712): https://edk2.groups.io/g/devel/message/43712 Mute This Topic: https://groups.io/mt/32476116/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-