public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size
@ 2018-06-25 18:15 Thomas Palmer
  2018-06-26  0:51 ` Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Palmer @ 2018-06-25 18:15 UTC (permalink / raw)
  To: edk2-devel; +Cc: garyli, joseph.shifflett, ruiyu.ni, hao.a.wu, Thomas Palmer

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-27  1:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-25 18:15 [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size Thomas Palmer
2018-06-26  0:51 ` Wu, Hao A
2018-06-27  1:04   ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox