Implementation for EFI_HII_FONT_PROTOCOL.\r
\r
\r
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2015, 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
)\r
{\r
UINTN FontInfoLen;\r
+ UINTN NameSize;\r
\r
ASSERT (FontName != NULL && FontInfo != NULL);\r
\r
- FontInfoLen = sizeof (EFI_FONT_INFO) - sizeof (CHAR16) + StrSize (FontName);\r
+ NameSize = StrSize (FontName);\r
+ FontInfoLen = sizeof (EFI_FONT_INFO) - sizeof (CHAR16) + NameSize;\r
*FontInfo = (EFI_FONT_INFO *) AllocateZeroPool (FontInfoLen);\r
if (*FontInfo == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- StrCpy ((*FontInfo)->FontName, FontName);\r
+ StrCpyS ((*FontInfo)->FontName, NameSize / sizeof (CHAR16), FontName);\r
return EFI_SUCCESS;\r
}\r
\r
{\r
EFI_FONT_DISPLAY_INFO *Info;\r
UINTN InfoSize;\r
+ UINTN NameSize;\r
\r
if (Private == NULL || Private->Signature != HII_DATABASE_PRIVATE_DATA_SIGNATURE) {\r
return EFI_INVALID_PARAMETER;\r
//\r
// The standard font always has the name "sysdefault".\r
//\r
- InfoSize = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + StrSize (L"sysdefault");\r
+ NameSize = StrSize (L"sysdefault");\r
+ InfoSize = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + NameSize;\r
Info = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (InfoSize);\r
if (Info == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
Info->FontInfoMask = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE;\r
Info->FontInfo.FontStyle = 0;\r
Info->FontInfo.FontSize = EFI_GLYPH_HEIGHT;\r
- StrCpy (Info->FontInfo.FontName, L"sysdefault");\r
+ StrCpyS (Info->FontInfo.FontName, NameSize / sizeof (CHAR16), L"sysdefault");\r
\r
*FontInfo = Info;\r
if (FontInfoSize != NULL) {\r
EFI_STRING String;\r
UINTN StringSize;\r
UINTN FontLen;\r
+ UINTN NameSize;\r
EFI_FONT_INFO *StringFontInfo;\r
EFI_FONT_DISPLAY_INFO *NewStringInfo;\r
CHAR8 TempSupportedLanguages;\r
// StringFontInfo equals NULL means system default font attaches with the string block.\r
//\r
if (StringFontInfo != NULL && IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfo, NULL, NULL)) {\r
- FontLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + StrSize (StringFontInfo->FontName);\r
+ NameSize = StrSize (StringFontInfo->FontName);\r
+ FontLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + NameSize;\r
NewStringInfo = AllocateZeroPool (FontLen);\r
if (NewStringInfo == NULL) { \r
Status = EFI_OUT_OF_RESOURCES;\r
NewStringInfo->FontInfoMask = EFI_FONT_INFO_SYS_FORE_COLOR | EFI_FONT_INFO_SYS_BACK_COLOR;\r
NewStringInfo->FontInfo.FontStyle = StringFontInfo->FontStyle;\r
NewStringInfo->FontInfo.FontSize = StringFontInfo->FontSize; \r
- StrCpy (NewStringInfo->FontInfo.FontName, StringFontInfo->FontName);\r
+ StrCpyS (NewStringInfo->FontInfo.FontName, NameSize / sizeof (CHAR16), StringFontInfo->FontName);\r
\r
Status = HiiStringToImage (\r
This, \r