]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
MdeModulePkg:Use safe string functions
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / Database.c
index 70c0385d88990c7fc875ebbc025664480f12567c..7ea2e723a50eda93b1e15c2eea612f2584e3c3b7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation for EFI_HII_DATABASE_PROTOCOL.\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
@@ -798,7 +798,7 @@ InsertStringPackage (
   if (Language == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  AsciiStrCpy (Language, (CHAR8 *) PackageHdr + HeaderSize - LanguageSize);\r
+  AsciiStrCpyS (Language, LanguageSize / sizeof (CHAR8), (CHAR8 *) PackageHdr + HeaderSize - LanguageSize);\r
   for (Link = PackageList->StringPkgHdr.ForwardLink; Link != &PackageList->StringPkgHdr; Link = Link->ForwardLink) {\r
     StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);\r
     if (HiiCompareLanguage (Language, StringPackage->StringPkgHdr->Language)) {\r
@@ -1182,7 +1182,7 @@ InsertFontPackage (
   }\r
   FontInfo->FontStyle = FontPkgHdr->FontStyle;\r
   FontInfo->FontSize  = FontPkgHdr->Cell.Height;\r
-  StrCpy (FontInfo->FontName, FontPkgHdr->FontFamily);\r
+  StrCpyS (FontInfo->FontName, sizeof (FontInfo->FontName) / sizeof (CHAR16), FontPkgHdr->FontFamily);\r
 \r
   if (IsFontInfoExisted (Private, FontInfo, NULL, NULL, NULL)) {\r
     Status = EFI_UNSUPPORTED;\r