]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
authorStar Zeng <star.zeng@intel.com>
Wed, 15 Jun 2016 05:38:56 +0000 (13:38 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 21 Jun 2016 04:46:25 +0000 (12:46 +0800)
It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h

index 3764b243444c6d8efbe46eb68d26dbe10734ba22..9bf1ced3cc7ec08a4d602fb4c0f05a91347331f8 100644 (file)
@@ -239,7 +239,7 @@ OpalDriverPopUpHddPassword (
     return NULL;\r
   }\r
 \r
-  UnicodeStrToAsciiStr(Unicode, Ascii);\r
+  UnicodeStrToAsciiStrS (Unicode, Ascii, MAX_PASSWORD_SIZE + 1);\r
 \r
   return Ascii;\r
 }\r
@@ -616,7 +616,7 @@ OpalDriverGetDeviceNameByProtocol(
         ASSERT (Dev->Name16 != NULL);\r
         StrCpyS (Dev->Name16, StrLength, DevName);\r
         Dev->NameZ = (CHAR8*)AllocateZeroPool(StrLength);\r
-        UnicodeStrToAsciiStr(DevName, Dev->NameZ);\r
+        UnicodeStrToAsciiStrS (DevName, Dev->NameZ, StrLength);\r
 \r
         //\r
         // Retrieve bridge BDF info and port number or namespace depending on type\r
index 7a4b8720487da4e9df863a16ba8d5490c3d3ca2b..9a44c5697e8e0d8ebea5fabe9c4d6e06f3708216 100644 (file)
@@ -600,7 +600,7 @@ HiiPsidRevert(
 \r
   OpalHiiGetBrowserData();\r
 \r
-  UnicodeStrToAsciiStr(gHiiConfiguration.Psid, (CHAR8*)Psid.Psid);\r
+  UnicodeStrToAsciiStrS (gHiiConfiguration.Psid, (CHAR8*)Psid.Psid, PSID_CHARACTER_LENGTH);\r
 \r
   OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);\r
   if (OpalDisk != NULL) {\r
@@ -1049,7 +1049,7 @@ HiiPasswordEntered(
     return EFI_BUFFER_TOO_SMALL;\r
   }\r
 \r
-  UnicodeStrToAsciiStr(UniStr, Password);\r
+  UnicodeStrToAsciiStrS (UniStr, Password, sizeof (Password));\r
   gBS->FreePool(UniStr);\r
 \r
   if (gHiiConfiguration.SelectedAction == HII_KEY_ID_GOTO_UNLOCK) {\r
@@ -1288,7 +1288,7 @@ HiiSetFormString(
   //\r
   // Copy into unicode string, then copy into string id\r
   //\r
-  AsciiStrToUnicodeStr( SrcAsciiStr, UniStr );\r
+  AsciiStrToUnicodeStrS ( SrcAsciiStr, UniStr, Len + 1);\r
 \r
   //\r
   // Update the string in the form\r
index 366cd3813eb9b6e39dae93b0620928d115f50ad4..bb086bd35f5e90c83a7c734b7fbf084a6e6cd093 100644 (file)
@@ -53,7 +53,7 @@ typedef struct {
 * The type indicates the structure of the PSID authority\r
 */\r
 typedef struct {\r
-    UINT8 Psid[32];\r
+    UINT8 Psid[PSID_CHARACTER_LENGTH];\r
 } TCG_PSID;\r
 \r
 /**\r