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