From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B090E940F5A for ; Fri, 8 Sep 2023 01:22:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KColpSULCLsH2EupbM1H97dzr4FpaRmv2YWyCf1gHng=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1694136146; v=1; b=kEPDsNU2arC7nTrVgvkhCLBFMk0Bemdr2XYaPTTRvt1JFSkaLe73VT1kLrwNbuSP7AARNQ8J MxfohhTDzXUgXbEnY4cxqsfz4X2SGyYh0qW3AtvFp9Nj74SykidHsnrk9Bx2h8q91tb6chBkebx nmP7SNzXxxg/0haL7SUN1etk= X-Received: by 127.0.0.2 with SMTP id jUPvYY7687511xDIxGHqZSJK; Thu, 07 Sep 2023 18:22:26 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.30344.1694136145789561034 for ; Thu, 07 Sep 2023 18:22:25 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10826"; a="376434480" X-IronPort-AV: E=Sophos;i="6.02,236,1688454000"; d="scan'208";a="376434480" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2023 18:22:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10826"; a="807764770" X-IronPort-AV: E=Sophos;i="6.02,236,1688454000"; d="scan'208";a="807764770" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 07 Sep 2023 18:22:19 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 7 Sep 2023 18:22:19 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 7 Sep 2023 18:22:18 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Thu, 7 Sep 2023 18:22:18 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Thu, 7 Sep 2023 18:22:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PN7ZnyNvkgZU2TEHnfa2Gs/RGff4r/3UTMdu2FWxc4EQQEsUEgtAEel0xh7uHNEfiPRkucRHKIvcjaBzaC6l2W9EjpqIdHOOpiG8J/fff4PnwhfUsmpFYmzrsc/DgI8ct36Cr+KsoPtHUSj9ggOehiI5MO7R84s1G0a9f+ZmeqRK3p7nRnhnd4uNlfDr3yRRhhI2EqzNaH0ONpkwvPDkzka9iSclRBL8UgpLrxNMM7Q9w/OAmVa/ZMFDZRGxdJ59U+Acr79X4RGWadire6cfqIrXrcK2Ttj+fYLyArKi+hgppxqbponChGj6a2M1oKT8G6/4nwETt0STm47cLu+wFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AyJi3n71butxTZmN414j4GUlAbLrCX3ZQVz/L+SMOwI=; b=a6QWll/QA2eGrHg0QXL28XKTmlEqMCzJFBNS+GNPWPfADZJXREhutsf6X0H00UwBWhhpkNZx7X+I23gxxwhcKCESWA11pH4uXtAOOqWhqzGzDf6QLByyUin3F5DedhsaTt+Ah+91BunGtggRlmYM5wTV9Lf+6qcF+O//OR1znRcXLvsUyT2giO2niPG8S+eqvcYgX2xXVPuACY8L+IUlQqXENpQCarcNTE2Vdf7iSFtSu535ncNmOz0alLZzJCUvl08EoiMZtXNzF75emniS6LXydcQPrhp/ncPZC6A/+ywmpIySliFF+A9mAuGoQSekjocWA2iej3fQSOqu2nVXbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8242.namprd11.prod.outlook.com (2603:10b6:208:474::11) by DM4PR11MB5996.namprd11.prod.outlook.com (2603:10b6:8:5f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.32; Fri, 8 Sep 2023 01:22:16 +0000 X-Received: from MN6PR11MB8242.namprd11.prod.outlook.com ([fe80::669d:e74:3693:7622]) by MN6PR11MB8242.namprd11.prod.outlook.com ([fe80::669d:e74:3693:7622%7]) with mapi id 15.20.6745.034; Fri, 8 Sep 2023 01:22:16 +0000 From: "Dandan Bi" To: Mike Beaton , "devel@edk2.groups.io" CC: "Dong, Eric" , Ard Biesheuvel Subject: Re: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size Thread-Topic: [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size Thread-Index: AQHZ4TxakXAH6IJm1kOzqvLR16MMDLAQIy7g Date: Fri, 8 Sep 2023 01:22:16 +0000 Message-ID: References: <20230907033441.1915-2-mjsbeaton@gmail.com> In-Reply-To: <20230907033441.1915-2-mjsbeaton@gmail.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8242:EE_|DM4PR11MB5996:EE_ x-ms-office365-filtering-correlation-id: 11dcc4b7-78c5-41f3-7d25-08dbb00a09de x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: kOkFkYmQRSGXDbmVEy486UWKz44J6nJWjtNKNyUMeV6RQ/sZfJ0yPD9VSNuA6PiibHS2T1KvQd1Kzut/EbsrDfgDZ0BIZXTNm72e/9+TvMbdp1aEz2YjqDIA8/vzL8ifdr9Ib4Y0+5zYIpNnMZiWnesNfZfqFcRWovfTXtzBJoXJlKd7UN4Z7EpW5IyBS8+oSw1+aTi4RHiKZx9vABpSLFIVVi5OvP179d/CJUBqW5Gjy3cBR3qlvKIQI+0kqFPxvdmrZ0CY8npEJYhNMQF26X2wgRr+bMCnIBWhdBRUO+yctjsQdU9s7EFl/bVEeUr29xf0vB3m8Nsc52Bd3gEWdJYa25YGE8yKHThqVUt0YcoqCycyudSNQKO12E0AABFI3f6mSEG1NVxP1f/5PV/yX8qebCbcNT8l7PDPtqswANakwTDsU/AOYaHi1x62supFMX679xHUkX7qetUh1iXvQpebeHE+fPwX4xE9G8cHbr/5hzi5vj3y3Dn8+nyooG0LWtUeBwm9JbavjYa6AddtLG+yHdikrg2J81feDzz9NDDotInS8/BowLrszzhmGQ0GjavfPHafdWmn958BZ1qGXauuJp948QJ2AkvFf0yLVtwX74xAdjJ2lgoNt/HnV2oX x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ttTdXMtFuQTpTbJpS1ap2I74Q+pG7FcrWy4raF192D1/Wki+RK2+d3cnj2AD?= =?us-ascii?Q?iE6S+LbOhbqdVczx/vNKvQ0qailS2Qxfgn9746I6bhRs8XLs+kfaUnjcPAew?= =?us-ascii?Q?S3y7cDdJc1NBtqDyNyeA1EiZceiONcmjytOal4W6w7DhbeOoszZnoOY8Jo+N?= =?us-ascii?Q?VOxWwn6p6ppZ/uZK2Alz4108eMOATqnPREr2eCsuQbYuBWAY6Qy+A5sRhJw8?= =?us-ascii?Q?p+F9IvMtu2iEzgwZ5G9TI7HyrEdmsS9/U4W5URAYIevNi3iI2yHkEl54n3s8?= =?us-ascii?Q?C2PL0Pe0/U3qnnbW7Cf12MhW9o3uGya37GWndKQKH2fQsDA69SIad6jKpvVt?= =?us-ascii?Q?1CiKuLGDUfBJPkTPFFi9LMknxvjh2PWMO5WwwBJmkuMSmxhqWf0e8fG+HO6p?= =?us-ascii?Q?jEP+CVrHAdoRR+eOsnPOFXz8CZtzP1Aj/iSAGbFgGrfomVtTQWxnrgHQdvM6?= =?us-ascii?Q?bisr9FOGoIwiHYnXKC07ECOXx+lsF530wKtqKvMLiU924wPb0NdOAYamBzad?= =?us-ascii?Q?qHbOSIS/yyw7J14SsG1IemU8TM5vfIM8AuzHnCGY8QBkBXlaovhKoA5rkHg0?= =?us-ascii?Q?pPMHdc4HsQdsM3vu8AogoRKZN/wBuCqjW822x67xiHm4mT9simSesvbARSG9?= =?us-ascii?Q?MNmC5svSuILZZH3ojmo6WmvQS2M15NRfxpOhK8IAR5pdXU2gyqpRsl/Tgo8X?= =?us-ascii?Q?EH2D95t/SwJy4CkZczVAo9+kCVjIqE5eFMftO7OhzJUeRqcY3narLePV+p3a?= =?us-ascii?Q?ez216k49JHdLeEBuw6zMWW5GtBJylp8AonfThSXUnur4bJYSHdxKYXLzGwu5?= =?us-ascii?Q?h7ruZevWYvoDzTLwB+USBOzWM5KXLgBAr9iwvcE79qRlRHMXv68SxApWiJcL?= =?us-ascii?Q?CQsC/+h4BCxElDA6+gU3J0SOHTRAeoVoJaG6Pv8G0z+wX4/ehTsikopv9S1F?= =?us-ascii?Q?jHQyiJoNv3pREpy9IQG39e0y8Ls2GFDpHXbO3ED58ky1eoy6Jj9i0lIn9oPK?= =?us-ascii?Q?hlLsrEiyc97+L01iRJ4skJDoJcqrfg9NFDaR/3fI8k1vc0hAcRiyPWRdKP1z?= =?us-ascii?Q?Fr4bfoAi77pAIQjlpDGisBlTMzrZgF0uUIa4K6Lic5dVgNIwCIZYcWQJv+IS?= =?us-ascii?Q?kddlddF3FQ/Cbm5zT8Qrp7p1faQ6hRl9pJmvF8d1BVg+EE1Td+kyDWHLMxnd?= =?us-ascii?Q?FNTUAslTZ+GspntdANUrWBT0lelOCrvcbwD71DiAwELelIWTBJ3OerPQuYiA?= =?us-ascii?Q?lv35hrXUa0YbzzNOz8eSNrzds50Ah+oogShpwyNvsXdQGu2P5C9MIU3Eo8Kf?= =?us-ascii?Q?gbzbWKgrxBX7yi2VjTPDl9y+KSe5WC9lmt057kSN44aUmL3zfNLD7HHnXpwg?= =?us-ascii?Q?4bK0KJP5HE9VkocypuUsf9gHpQQTI35drFg088Aw0/PvARVLo/ZmLqwlay2i?= =?us-ascii?Q?fCqujreeJa6nKMYmhUoemJJjNGNr/sjnAspC3qfb/UcfqtwgudfbkTg7bbhq?= =?us-ascii?Q?z07F/NZRL5hig+0Yz6/fq2CluKv9vQOB2g4XMHvoplUdjOCgRbJiWuc+XcGs?= =?us-ascii?Q?L/yI+WXhqgih4xPOlgihwQADhmHpsY8bzlGyolDc?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8242.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11dcc4b7-78c5-41f3-7d25-08dbb00a09de X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Sep 2023 01:22:16.4445 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1pyPxkjm5adCfdf8hP3b8Mw/hE6f2Rg1X/zSFtnC+qZ4AlT/z+G8h1FUyps24dMOAC940ZunvccFa+XjVh9BSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5996 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: 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,dandan.bi@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: uUVbn2zm4JbnLIyR730bGJ7ex7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kEPDsNU2; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Dandan Bi Thanks, Dandan -----Original Message----- From: Mike Beaton =20 Sent: Thursday, September 7, 2023 11:35 AM To: devel@edk2.groups.io Cc: Dong, Eric ; Bi, Dandan ; Ard= Biesheuvel ; Mike Beaton Subject: [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPoo= l size The immediately preceding call, GetBestLanguage, plus the implementation of= HiiGetString, which is called immediately afterwards, make it clear that B= estLanguage is a null-terminated ASCII string, and not just a five byte, no= n-null terminated buffer. Therefore AsciiStrLen is one byte too short, meaning that whether the space= allocated is really sufficient and whether the resultant string is really = null-terminated becomes implementation-dependent. Rather than switching to = AsciiStrSize, we use an explicitly compile-time string length calculation (= both compile-time and run-time approaches are currently used elsewhere in t= he codebase for copying static strings). Signed-off-by: Mike Beaton --- MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c b= /MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c index 96e05d4cf9..6e791783a6 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c @@ -1987,7 +1987,7 @@ GetNameFromId ( NULL ); if (BestLanguage =3D=3D NULL) { - BestLanguage =3D AllocateCopyPool (AsciiStrLen ("en-US"), "en-US"); + BestLanguage =3D AllocateCopyPool (sizeof ("en-US"), "en-US"); ASSERT (BestLanguage !=3D NULL); } =20 -- 2.41.0 -=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 (#108433): https://edk2.groups.io/g/devel/message/108433 Mute This Topic: https://groups.io/mt/101208544/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-