diff options
author | Dandan Bi <dandan.bi@intel.com> | 2015-06-29 02:36:31 +0000 |
---|---|---|
committer | dandanbi <dandanbi@Edk2> | 2015-06-29 02:36:31 +0000 |
commit | 5ad66ec6925f1564137752be4d8656d462ebeaf2 (patch) | |
tree | 62c65c37d412e3ab06e55fa209a2e4f013f9f576 /MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | |
parent | e9da7deaa475fee947760d49e46c74bae90449ad (diff) | |
download | edk2-platforms-5ad66ec6925f1564137752be4d8656d462ebeaf2.tar.xz |
MdeModulePkg:Use safe string functions
Replace unsafe String functions with new added safe string functions
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17724 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Expression.c')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c index f1a65b2e89..688a1d66cb 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c @@ -1324,6 +1324,7 @@ IfrCatenate ( UINT16 Length0;
UINT16 Length1;
UINT8 *TmpBuf;
+ UINTN MaxLen;
//
// String[0] - The second string
@@ -1363,10 +1364,11 @@ IfrCatenate ( if (Value[0].Type == EFI_IFR_TYPE_STRING) {
Size = StrSize (String[0]);
- StringPtr= AllocatePool (StrSize (String[1]) + Size);
+ MaxLen = (StrSize (String[1]) + Size) / sizeof (CHAR16);
+ StringPtr= AllocatePool (MaxLen * sizeof (CHAR16));
ASSERT (StringPtr != NULL);
- StrCpy (StringPtr, String[1]);
- StrCat (StringPtr, String[0]);
+ StrCpyS (StringPtr, MaxLen, String[1]);
+ StrCatS (StringPtr, MaxLen, String[0]);
Result->Type = EFI_IFR_TYPE_STRING;
Result->Value.string = NewString (StringPtr, FormSet->HiiHandle);
|