public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Thomas Palmer <thomas.palmer@hpe.com>
To: edk2-devel@lists.01.org
Cc: garyli@hpe.com, joseph.shifflett@hpe.com, ruiyu.ni@intel.com,
	hao.a.wu@intel.com, Thomas Palmer <thomas.palmer@hpe.com>
Subject: [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size
Date: Mon, 25 Jun 2018 13:15:18 -0500	[thread overview]
Message-ID: <1529950518-16132-1-git-send-email-thomas.palmer@hpe.com> (raw)

A single byte was allocate for a CHAR16 NUL terminator when instead
two bytes should have been used.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
---
 Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
index 1516ab8d1c12..cfce4a0af345 100644
--- a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
+++ b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c
@@ -1,6 +1,7 @@
 /**@file
 
 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -453,7 +454,7 @@ Returns:
     ASSERT (PcdTempStr != NULL);
 
     TempStrSize = StrLen (PcdTempStr);
-    TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);
+    TempStr = AllocateMemory (((TempStrSize + 1) * sizeof (CHAR16)));
     StrCpy (TempStr, PcdTempStr);
 
     StartString = TempStr;
-- 
2.7.4



             reply	other threads:[~2018-06-25 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 18:15 Thomas Palmer [this message]
2018-06-26  0:51 ` [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size Wu, Hao A
2018-06-27  1:04   ` Wu, Hao A

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=1529950518-16132-1-git-send-email-thomas.palmer@hpe.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