diff mbox series

[edk2,1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size

Message ID 1529950518-16132-1-git-send-email-thomas.palmer@hpe.com
State Accepted
Commit d1fbfd7cd39af04d80ee9dab1455cccdf84aa316
Headers show
Series [edk2,1/1] Nt32Pkg/WinNtBusDriverDxe: Fix memory allocation size | expand

Commit Message

Palmer, Thomas June 25, 2018, 6:15 p.m. UTC
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(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Wu, Hao A June 26, 2018, 12:51 a.m. UTC | #1
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
Wu, Hao A June 27, 2018, 1:04 a.m. UTC | #2
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

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;