Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <Eric.Dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15797
6f19259b-4bc3-4df7-8a09-
765794883524
/** @file\r
The platform device manager reference implementation\r
\r
/** @file\r
The platform device manager reference implementation\r
\r
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
LIST_ENTRY *Link;\r
EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;\r
BOOLEAN RebootRequired;\r
LIST_ENTRY *Link;\r
EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;\r
BOOLEAN RebootRequired;\r
\r
Index = 0;\r
DriverHealthInfo = NULL; \r
\r
Index = 0;\r
DriverHealthInfo = NULL; \r
//\r
// Assume no line strings is longer than 512 bytes.\r
//\r
//\r
// Assume no line strings is longer than 512 bytes.\r
//\r
- String = (EFI_STRING) AllocateZeroPool (0x200);\r
+ StringSize = 0x200;\r
+ String = (EFI_STRING) AllocateZeroPool (StringSize);\r
ASSERT (String != NULL);\r
\r
Status = DriverHealthGetDriverName (DriverHealthInfo->DriverHandle, &DriverName);\r
ASSERT (String != NULL);\r
\r
Status = DriverHealthGetDriverName (DriverHealthInfo->DriverHandle, &DriverName);\r
}\r
\r
ASSERT (TmpString != NULL);\r
}\r
\r
ASSERT (TmpString != NULL);\r
- StrCat (String, TmpString);\r
+ StrnCat (String, TmpString, StringSize / sizeof (CHAR16) - StrLen (String) - 1);\r
FreePool (TmpString);\r
\r
Token = HiiSetString (HiiHandle, 0, String, NULL);\r
FreePool (TmpString);\r
\r
Token = HiiSetString (HiiHandle, 0, String, NULL);\r
/** @file\r
Perform the platform memory test\r
\r
/** @file\r
Perform the platform memory test\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;\r
BOOLEAN IsFirstBoot;\r
UINT32 TempData;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;\r
BOOLEAN IsFirstBoot;\r
UINT32 TempData;\r
+ UINTN StrTotalMemorySize;\r
\r
ReturnStatus = EFI_SUCCESS;\r
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));\r
\r
\r
ReturnStatus = EFI_SUCCESS;\r
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));\r
\r
- Pos = AllocatePool (128);\r
+ StrTotalMemorySize = 128;\r
+ Pos = AllocateZeroPool (StrTotalMemorySize);\r
\r
if (Pos == NULL) {\r
return ReturnStatus;\r
\r
if (Pos == NULL) {\r
return ReturnStatus;\r
//\r
// TmpStr size is 64, StrPercent is reserved to 16.\r
//\r
//\r
// TmpStr size is 64, StrPercent is reserved to 16.\r
//\r
- StrCat (StrPercent, TmpStr);\r
+ StrnCat (StrPercent, TmpStr, sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1);\r
PrintXY (10, 10, NULL, NULL, StrPercent);\r
FreePool (TmpStr);\r
}\r
PrintXY (10, 10, NULL, NULL, StrPercent);\r
FreePool (TmpStr);\r
}\r
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);\r
if (StrTotalMemory[0] == L',') {\r
StrTotalMemory++;\r
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);\r
if (StrTotalMemory[0] == L',') {\r
StrTotalMemory++;\r
+ StrTotalMemorySize -= sizeof (CHAR16);\r
}\r
\r
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));\r
if (TmpStr != NULL) {\r
}\r
\r
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));\r
if (TmpStr != NULL) {\r
- StrCat (StrTotalMemory, TmpStr);\r
+ StrnCat (StrTotalMemory, TmpStr, StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1);\r
FreePool (TmpStr);\r
}\r
\r
FreePool (TmpStr);\r
}\r
\r