Reviewed-by:  Qiu Shumin <shumin....@intel.com> 

-----Original Message-----
From: Bi, Dandan 
Sent: Thursday, July 02, 2015 6:24 PM
To: Gao, Liming; Dong, Eric; Qiu, Shumin; edk2-devel@lists.sourceforge.net
Subject: [patch] MdeModulePkg:Modify the incorrect DestStr length in safe 
string functions

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
Reviewed-by: Eric Dong <eric.d...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 2 +-
 MdeModulePkg/Universal/HiiDatabaseDxe/String.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 7ea2e72..0872830 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -1180,11 +1180,11 @@ InsertFontPackage (
     Status = EFI_OUT_OF_RESOURCES;
     goto Error;
   }
   FontInfo->FontStyle = FontPkgHdr->FontStyle;
   FontInfo->FontSize  = FontPkgHdr->Cell.Height;
-  StrCpyS (FontInfo->FontName, sizeof (FontInfo->FontName) / sizeof (CHAR16), 
FontPkgHdr->FontFamily);
+  StrCpyS (FontInfo->FontName, (FontInfoSize - 
OFFSET_OF(EFI_FONT_INFO,FontSize)) / sizeof (CHAR16), FontPkgHdr->FontFamily);
 
   if (IsFontInfoExisted (Private, FontInfo, NULL, NULL, NULL)) {
     Status = EFI_UNSUPPORTED;
     goto Error;
   }
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index a832486..efd16f5 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -1331,11 +1331,11 @@ HiiNewString (
     StringPackage->StringPkgHdr->Header.Type      = EFI_HII_PACKAGE_STRINGS;
     StringPackage->StringPkgHdr->HdrSize          = HeaderSize;
     StringPackage->StringPkgHdr->StringInfoOffset = HeaderSize;
     CopyMem (StringPackage->StringPkgHdr->LanguageWindow, mLanguageWindow, 16 
* sizeof (CHAR16));
     StringPackage->StringPkgHdr->LanguageName     = 1;
-    AsciiStrCpyS (StringPackage->StringPkgHdr->Language, 
sizeof(StringPackage->StringPkgHdr->Language) / sizeof (CHAR8), (CHAR8 *) 
Language);
+    AsciiStrCpyS (StringPackage->StringPkgHdr->Language, (HeaderSize - 
OFFSET_OF(EFI_HII_STRING_PACKAGE_HDR,LanguageName)) / sizeof (CHAR8), (CHAR8 *) 
Language);
 
     //
     // Calculate the length of the string blocks, including string block to 
record
     // printable language full name and EFI_HII_SIBT_END_BLOCK.
     //
-- 
1.9.5.msysgit.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to