public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: Thomas Palmer <thomas.palmer@hpe.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun
Date: Thu, 13 Oct 2016 08:59:38 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E33851@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1476304179-6493-1-git-send-email-thomas.palmer@hpe.com>



Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
>-----Original Message-----
>From: Thomas Palmer [mailto:thomas.palmer@hpe.com]
>Sent: Thursday, October 13, 2016 4:30 AM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; joseph.shifflett@hpe.com; Thomas Palmer <thomas.palmer@hpe.com>
>Subject: [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun
>
>When allocating memory for a string, the CHAR16 NUL character needs
>two bytes of space. Use StrSize to get accurate size
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
>---
> Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
>index 1516ab8..c46ee07 100644
>--- a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
>+++ b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
>@@ -452,8 +452,8 @@ Returns:
>     PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token);
>     ASSERT (PcdTempStr != NULL);
>
>-    TempStrSize = StrLen (PcdTempStr);
>-    TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);
>+    TempStrSize = StrSize (PcdTempStr);
>+    TempStr = AllocateMemory (TempStrSize);
>     StrCpy (TempStr, PcdTempStr);
>
>     StartString = TempStr;
>--
>2.7.4



      reply	other threads:[~2016-10-13  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 20:29 [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun Thomas Palmer
2016-10-13  8:59 ` Ni, Ruiyu [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=734D49CCEBEEF84792F5B80ED585239D58E33851@SHSMSX104.ccr.corp.intel.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