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 3D1D3740032 for ; Mon, 11 Sep 2023 00:44:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=pBFNDVSmBzfydbLNCkEwl6cYVEhYjl9cHl95uFAh+/8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Language; s=20140610; t=1694393055; v=1; b=VhWWi3q/SgLOTAw6+Jx40J0k5+6dey+b6QtLVSU44zYFWfumloURj9xy6x6nUSn1C6NLYcau 2bQm+PHgw6C1pN3K5bV4V/p8JX8iBABJPpQiUVS1yRT3w+2f8g1LKFULgrzriwgs/pKGHnHUaXK 6TfMZPU4wOG22iX8sja8EDqE= X-Received: by 127.0.0.2 with SMTP id WAFDYY7687511xwtv2EDPoSn; Sun, 10 Sep 2023 17:44:15 -0700 X-Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web10.48538.1694393053952860448 for ; Sun, 10 Sep 2023 17:44:15 -0700 X-Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id A6EA1DDA7C8 for ; Mon, 11 Sep 2023 08:44:10 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id A2418DDA7B9 for ; Mon, 11 Sep 2023 08:44:10 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id 02FDEDDA79F for ; Mon, 11 Sep 2023 08:44:06 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Mon, 11 Sep 2023 08:44:05 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: , , "'Mike Beaton'" Cc: "'Dong, Eric'" , "'Ard Biesheuvel'" References: <20230907033441.1915-2-mjsbeaton@gmail.com> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHY1XSBNZGVNb2R1bGVQa2cvSGlpRGF0YWJhc2U6IEZpeCBpbmNvcnJlY3QgQWxsb2NhdGVDb3B5UG9vbCBzaXpl?= Date: Mon, 11 Sep 2023 08:44:06 +0800 Message-ID: <014701d9e449$11f69ae0$35e3d0a0$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQG/VzdnHNa3NPk28AA6S32YwzsCGgLo769YsDKcH7A= 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,gaoliming@byosoft.com.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: wuCEciZ0yQnQEbBX8OUWNErgx7686176AA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="VhWWi3q/"; dmarc=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 PR https://github.com/tianocore/edk2/pull/4816 is created to merge this patch.=20 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Dandan Bi > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA9=D4=C28=C8=D5 9:22 > =CA=D5=BC=FE=C8=CB: Mike Beaton ; devel@edk2.groups.= io > =B3=AD=CB=CD: Dong, Eric ; Ard Biesheuvel > =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix i= ncorrect > AllocateCopyPool size >=20 > Reviewed-by: Dandan Bi >=20 >=20 > Thanks, > Dandan >=20 > -----Original Message----- > From: Mike Beaton > 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 > AllocateCopyPool size >=20 > The immediately preceding call, GetBestLanguage, plus the implementation of > HiiGetString, which is called immediately afterwards, make it clear that > BestLanguage is a null-terminated ASCII string, and not just a five byte, > non-null terminated buffer. >=20 > 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 i= n > the codebase for copying static strings). >=20 > Signed-off-by: Mike Beaton > --- > MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 >=20 >=20 >=20 >=20 >=20 -=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 (#108468): https://edk2.groups.io/g/devel/message/108468 Mute This Topic: https://groups.io/mt/101283979/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-