From: "gaoliming via groups.io" <gaoliming=byosoft.com.cn@groups.io>
To: <devel@edk2.groups.io>, <dandan.bi@intel.com>,
"'Mike Beaton'" <mjsbeaton@gmail.com>
Cc: "'Dong, Eric'" <eric.dong@intel.com>,
"'Ard Biesheuvel'" <ardb@kernel.org>
Subject: 回复: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size
Date: Mon, 11 Sep 2023 08:44:06 +0800 [thread overview]
Message-ID: <014701d9e449$11f69ae0$35e3d0a0$@byosoft.com.cn> (raw)
In-Reply-To: <MN6PR11MB8242B5A4F8B955E71E284F47EAEDA@MN6PR11MB8242.namprd11.prod.outlook.com>
PR https://github.com/tianocore/edk2/pull/4816 is created to merge this
patch.
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Dandan Bi
> 发送时间: 2023年9月8日 9:22
> 收件人: Mike Beaton <mjsbeaton@gmail.com>; devel@edk2.groups.io
> 抄送: Dong, Eric <eric.dong@intel.com>; Ard Biesheuvel <ardb@kernel.org>
> 主题: Re: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect
> AllocateCopyPool size
>
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
>
>
> Thanks,
> Dandan
>
> -----Original Message-----
> From: Mike Beaton <mjsbeaton@gmail.com>
> Sent: Thursday, September 7, 2023 11:35 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Bi, Dandan <dandan.bi@intel.com>;
> Ard Biesheuvel <ardb@kernel.org>; Mike Beaton <mjsbeaton@gmail.com>
> Subject: [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect
> AllocateCopyPool size
>
> 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.
>
> 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
> the codebase for copying static strings).
>
> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
> ---
> 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 == NULL) {
> - BestLanguage = AllocateCopyPool (AsciiStrLen ("en-US"), "en-US");
> + BestLanguage = AllocateCopyPool (sizeof ("en-US"), "en-US");
> ASSERT (BestLanguage != NULL);
> }
>
> --
> 2.41.0
>
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
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]
-=-=-=-=-=-=-=-=-=-=-=-
prev parent reply other threads:[~2023-09-11 0:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 3:34 [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size Mike Beaton
2023-09-07 3:45 ` Mike Beaton
2023-09-07 10:33 ` Ard Biesheuvel
2023-09-08 0:45 ` 回复: " gaoliming via groups.io
2023-09-08 1:22 ` Dandan Bi
2023-09-11 0:44 ` gaoliming via groups.io [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='014701d9e449$11f69ae0$35e3d0a0$@byosoft.com.cn' \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox