Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>-----Original Message-----
>From: Thomas Palmer [mailto:thomas.pal...@hpe.com]
>Sent: Thursday, October 13, 2016 4:30 AM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu...@intel.com>; joseph.shiffl...@hpe.com; Thomas Palmer 
><thomas.pal...@hpe.com>
>Subject: [PATCH] Nt32Pkg/WinNtBusDriverDxe: Fix small memory overrun
>
>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.pal...@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

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

Reply via email to