public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: "Sun, CepingX" <cepingx.sun@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [edk2-devel] [PATCH V1 1/1] SecurityPkg/DxeTpm2MeasureBootLib: Check the Integer overflow
Date: Wed, 29 Nov 2023 00:32:43 +0000	[thread overview]
Message-ID: <PH0PR11MB506496ADFA30EC12BF044099C583A@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20231127004101.495-1-cepingx.sun@intel.com>

Reviewed-by: Min Xu <min.m.xu@intel.com>

> -----Original Message-----
> From: Sun, CepingX <cepingx.sun@intel.com>
> Sent: Monday, November 27, 2023 8:41 AM
> To: devel@edk2.groups.io
> Cc: Sun, CepingX <cepingx.sun@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Xu, Min M <min.m.xu@intel.com>
> Subject: [PATCH V1 1/1] SecurityPkg/DxeTpm2MeasureBootLib: Check the
> Integer overflow
> 
> From: Ceping Sun <cepingx.sun@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4604
> 
> Fields of NumberOfPartitionEntries and SizeOfPartitionEntry in PrimaryHeader
> are both UINT32. UINT32 * UINT32 produce UINT32 but it may overflow. So
> The result should be checked if it is overflow.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
> ---
>  .../Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c    | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git
> a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
> b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
> index 36a256a7af50..1f891ae7f216 100644
> ---
> a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
> +++
> b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
> @@ -210,6 +210,11 @@ Tcg2MeasureGptTable (
>      return EFI_BAD_BUFFER_SIZE;
>    }
> 
> +  if (PrimaryHeader->NumberOfPartitionEntries > MAX_UINT32 /
> PrimaryHeader->SizeOfPartitionEntry) {
> +    DEBUG ((DEBUG_ERROR, "Overflow of PrimaryHeader-
> >NumberOfPartitionEntries(%d) * PrimaryHeader-
> >SizeOfPartitionEntry(%d)\n", PrimaryHeader->NumberOfPartitionEntries,
> PrimaryHeader->SizeOfPartitionEntry));
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
>    //
>    // Read the partition entry.
>    //
> --
> 2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111831): https://edk2.groups.io/g/devel/message/111831
Mute This Topic: https://groups.io/mt/102820849/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2023-11-29  0:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  0:41 [edk2-devel] [PATCH V1 1/1] SecurityPkg/DxeTpm2MeasureBootLib: Check the Integer overflow sunceping
2023-11-29  0:32 ` Min Xu [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=PH0PR11MB506496ADFA30EC12BF044099C583A@PH0PR11MB5064.namprd11.prod.outlook.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