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 656FED80121 for ; Fri, 8 Sep 2023 00:45:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cdJbGY2yPWv2xX00ZczGEUrhogO52XSfkxzwBV14hyg=; 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=1694133928; v=1; b=RvSgZkBej6qOjKhqTrixdnFxqb4gceU5kbi38Ih6x7PAdhioHKFuftHL9RtXM/2fRTRIYor9 tEO7w9S9G3/YkshBRZLWHXD/3Si1sLwYD0GQSPR6Lv0IJHAwzN+Y4liy4okt2lac2gDYJC9597y OclurcGtAsgXCBB2n8ibdVa8= X-Received: by 127.0.0.2 with SMTP id sAH7YY7687511xm6B7SpeR8J; Thu, 07 Sep 2023 17:45:28 -0700 X-Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web11.29699.1694133926209732204 for ; Thu, 07 Sep 2023 17:45:27 -0700 X-Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 8BEDFA32E1B7 for ; Fri, 8 Sep 2023 08:45:23 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 6A06AA32E19A for ; Fri, 8 Sep 2023 08:45:23 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id B01D1A32E1AC for ; Fri, 8 Sep 2023 08:45:20 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Fri, 08 Sep 2023 08:45:17 +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: , Cc: "'Eric Dong'" , "'Dandan Bi'" , "'Ard Biesheuvel'" References: <20230907033441.1915-2-mjsbeaton@gmail.com> In-Reply-To: <20230907033441.1915-2-mjsbeaton@gmail.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHY1XSBNZGVNb2R1bGVQa2cvSGlpRGF0YWJhc2U6IEZpeCBpbmNvcnJlY3QgQWxsb2NhdGVDb3B5UG9vbCBzaXpl?= Date: Fri, 8 Sep 2023 08:45:20 +0800 Message-ID: <006e01d9e1ed$bed30720$3c791560$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQG/VzdnHNa3NPk28AA6S32YwzsCGrBFLNFA 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: 1OYVnhErENh2QaMuTyTMwmJgx7686176AA= 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=RvSgZkBe; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none Mike: Thanks for your detail information in the commit message. This change is very clear.=20 Reviewed-by: Liming Gao Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Mike Beaton > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA9=D4=C27=C8=D5 11:35 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Eric Dong ; Dandan Bi ; > Ard Biesheuvel ; Mike Beaton > =D6=F7=CC=E2: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incor= rect > 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 (#108430): https://edk2.groups.io/g/devel/message/108430 Mute This Topic: https://groups.io/mt/101228368/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-