From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mx.groups.io with SMTP id smtpd.web09.6587.1627545015816035413 for ; Thu, 29 Jul 2021 00:50:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.255, mailfrom: xiewenyi2@huawei.com) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Gb2bd3v4Fz1CPCK; Thu, 29 Jul 2021 15:44:13 +0800 (CST) Received: from dggpemm000003.china.huawei.com (7.185.36.128) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 29 Jul 2021 15:50:10 +0800 Received: from HGH1000039998.huawei.com (10.184.68.188) by dggpemm000003.china.huawei.com (7.185.36.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 29 Jul 2021 15:50:09 +0800 From: "wenyi,xie" To: , , CC: , , Jiewen Yao , Laszlo Ersek Subject: [PATCH EDK2 v2 1/1] SecurityPkg/FvReportPei: remove redundant sizeof Date: Thu, 29 Jul 2021 15:45:28 +0800 Message-ID: <1627544728-82453-2-git-send-email-xiewenyi2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1627544728-82453-1-git-send-email-xiewenyi2@huawei.com> References: <1627544728-82453-1-git-send-email-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm000003.china.huawei.com (7.185.36.128) X-CFilter-Loop: Reflected Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3333 In function InstallPreHashFvPpi, when calculating the size of struct HASH_INFO=EF=BC=8Csizeof is used twice. This bug does not lead to buffer overflow, "sizeof (HASH_INFO)" is 4, whereas "sizeof (sizeof (HASH_INFO))" is 4 or 8. Cc: Jiewen Yao Cc: Jian J Wang Cc: Laszlo Ersek Signed-off-by: Wenyi Xie Reviewed-by: Laszlo Ersek --- SecurityPkg/FvReportPei/FvReportPei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecurityPkg/FvReportPei/FvReportPei.c b/SecurityPkg/FvReport= Pei/FvReportPei.c index d709760ea3ce..e82413e090c0 100644 --- a/SecurityPkg/FvReportPei/FvReportPei.c +++ b/SecurityPkg/FvReportPei/FvReportPei.c @@ -67,7 +67,7 @@ InstallPreHashFvPpi ( HASH_INFO *HashInfo; =20 PpiSize =3D sizeof (EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI) - + sizeof (sizeof (HASH_INFO)) + + sizeof (HASH_INFO) + HashSize; =20 PreHashedFvPpi =3D AllocatePool (PpiSize); --=20 2.20.1.windows.1