public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Beaton" <mjsbeaton@gmail.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Dandan Bi <dandan.bi@intel.com>,
	 Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size
Date: Thu, 7 Sep 2023 04:45:01 +0100	[thread overview]
Message-ID: <CAHzAAWSKvWE3SDmXd+9R0LJV6cE8Oc0pzdUi2Cm3t78qEZ=eJQ@mail.gmail.com> (raw)
In-Reply-To: <20230907033441.1915-2-mjsbeaton@gmail.com>

On Thu, 7 Sept 2023 at 04:35, Mike Beaton <mjsbeaton@gmail.com> wrote:
>
> 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).

Apologies for the multiple versions, but I thought it was important to
clarify in the
commit message above that this really was a fix, not a misunderstanding. I also
realised, in this last version, that sizeof is preferable here to
AsciiStrSize (and
that sizeof is, in fact, already often used when copying static
strings elsewhere
in the codebase - both sizeof and (Ascii)StrSize are used in various places, but
with more use of sizeof).


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108358): https://edk2.groups.io/g/devel/message/108358
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]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-09-07  3:45 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 [this message]
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

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='CAHzAAWSKvWE3SDmXd+9R0LJV6cE8Oc0pzdUi2Cm3t78qEZ=eJQ@mail.gmail.com' \
    --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