summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Service.c8
-rw-r--r--MdeModulePkg/Universal/PCD/Pei/Service.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index cf5f2444f6..eb1e1cef0b 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -142,6 +142,7 @@ GetPcdName (
{
PCD_DATABASE_INIT *Database;
UINT8 *StringTable;
+ UINTN NameSize;
PCD_NAME_INDEX *PcdNameIndex;
CHAR8 *TokenSpaceName;
CHAR8 *PcdName;
@@ -188,14 +189,15 @@ GetPcdName (
//
// Need to get the full PCD name.
//
- Name = AllocateZeroPool (AsciiStrSize (TokenSpaceName) + AsciiStrSize (PcdName));
+ NameSize = AsciiStrSize (TokenSpaceName) + AsciiStrSize (PcdName);
+ Name = AllocateZeroPool (NameSize);
ASSERT (Name != NULL);
//
// Catenate TokenSpaceCName and PcdCName with a '.' to form the full PCD name.
//
- AsciiStrCat (Name, TokenSpaceName);
+ AsciiStrCatS (Name, NameSize, TokenSpaceName);
Name[AsciiStrSize (TokenSpaceName) - sizeof (CHAR8)] = '.';
- AsciiStrCat (Name, PcdName);
+ AsciiStrCatS (Name, NameSize, PcdName);
}
return Name;
diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c b/MdeModulePkg/Universal/PCD/Pei/Service.c
index 83309a6f39..45ce01b1fa 100644
--- a/MdeModulePkg/Universal/PCD/Pei/Service.c
+++ b/MdeModulePkg/Universal/PCD/Pei/Service.c
@@ -107,6 +107,7 @@ GetPcdName (
)
{
UINT8 *StringTable;
+ UINTN NameSize;
PCD_NAME_INDEX *PcdNameIndex;
CHAR8 *TokenSpaceName;
CHAR8 *PcdName;
@@ -144,14 +145,15 @@ GetPcdName (
//
// Need to get the full PCD name.
//
- Name = AllocateZeroPool (AsciiStrSize (TokenSpaceName) + AsciiStrSize (PcdName));
+ NameSize = AsciiStrSize (TokenSpaceName) + AsciiStrSize (PcdName);
+ Name = AllocateZeroPool (NameSize);
ASSERT (Name != NULL);
//
// Catenate TokenSpaceCName and PcdCName with a '.' to form the full PCD name.
//
- AsciiStrCat (Name, TokenSpaceName);
+ AsciiStrCatS (Name, NameSize, TokenSpaceName);
Name[AsciiStrSize (TokenSpaceName) - sizeof (CHAR8)] = '.';
- AsciiStrCat (Name, PcdName);
+ AsciiStrCatS (Name, NameSize, PcdName);
}
return Name;