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

* Re: [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Wu, Hao A @ 2018-06-26  0:51 UTC (permalink / raw)
  To: Thomas Palmer, edk2-devel@lists.01.org
  Cc: garyli@hpe.com, joseph.shifflett@hpe.com, Ni, Ruiyu

Reviewed-by: Hao Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> -----Original Message-----
> From: Thomas Palmer [mailto:thomas.palmer@hpe.com]
> Sent: Tuesday, June 26, 2018 2:15 AM
> To: edk2-devel@lists.01.org
> Cc: garyli@hpe.com; joseph.shifflett@hpe.com; Ni, Ruiyu; Wu, Hao A; Thomas
> Palmer
> Subject: [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size
> 
> 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	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size
  2018-06-26  0:51 ` Wu, Hao A
@ 2018-06-27  1:04   ` Wu, Hao A
  0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2018-06-27  1:04 UTC (permalink / raw)
  To: Thomas Palmer, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu

Thanks a lot.

Pushed as commit:
d1fbfd7cd39af04d80ee9dab1455cccdf84aa316

Best Regards,
Hao Wu


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Wu,
> Hao A
> Sent: Tuesday, June 26, 2018 8:51 AM
> To: Thomas Palmer; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu
> Subject: Re: [edk2] [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory
> allocation size
> 
> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
> 
> Best Regards,
> Hao Wu
> 
> 
> > -----Original Message-----
> > From: Thomas Palmer [mailto:thomas.palmer@hpe.com]
> > Sent: Tuesday, June 26, 2018 2:15 AM
> > To: edk2-devel@lists.01.org
> > Cc: garyli@hpe.com; joseph.shifflett@hpe.com; Ni, Ruiyu; Wu, Hao A; Thomas
> > Palmer
> > Subject: [PATCH 1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation
> size
> >
> > 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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[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