From: Thomas Palmer <thomas.palmer@hpe.com>
To: edk2-devel@lists.01.org
Cc: ruiyu.ni@intel.com, joseph.shifflett@hpe.com,
Thomas Palmer <thomas.palmer@hpe.com>
Subject: [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun
Date: Wed, 12 Oct 2016 15:29:39 -0500 [thread overview]
Message-ID: <1476304179-6493-1-git-send-email-thomas.palmer@hpe.com> (raw)
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
next reply other threads:[~2016-10-12 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 20:29 Thomas Palmer [this message]
2016-10-13 8:59 ` [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun Ni, Ruiyu
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=1476304179-6493-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