Fix an issue that an assert occurrs if user inputs a password whose length is less...
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 16 Apr 2009 07:02:42 +0000 (07:02 +0000)
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 16 Apr 2009 07:02:42 +0000 (07:02 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8103 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c

index ac6f2ac..b8d0021 100644 (file)
@@ -690,10 +690,14 @@ CreateIfrDataArray (
       break;\r
 \r
     case EFI_IFR_TYPE_STRING:\r
-      String = HiiGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, NULL);\r
-      ASSERT (String != NULL);\r
+      if (Value->string == 0) {\r
+        Size = 0;\r
+      } else {\r
+        String = HiiGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, NULL);\r
+        ASSERT (String != NULL);\r
 \r
-      Size = StrSize (String);\r
+        Size = StrSize (String);\r
+      }\r
       break;\r
       \r
     default:\r
@@ -741,9 +745,11 @@ CreateIfrDataArray (
         break;\r
 \r
       case EFI_IFR_TYPE_STRING:\r
-        ASSERT (String != NULL);\r
-        StrCpy ((CHAR16 *) &IfrDataEntry->Data, String);\r
-        FreePool (String);\r
+        if (Size != 0) {\r
+          ASSERT (String != NULL);\r
+          StrCpy ((CHAR16 *) &IfrDataEntry->Data, String);\r
+          FreePool (String);\r
+        }\r
         break;\r
       default:\r
         ASSERT (FALSE);\r