]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/HiiDatabaseDxe: Add ASSERT before using the pointer 'String'
authorDandan Bi <dandan.bi@intel.com>
Fri, 24 Jun 2016 05:19:14 +0000 (13:19 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 28 Jun 2016 10:17:30 +0000 (18:17 +0800)
The 'Sting' is returned by the function GetUnicodeStringTextAndSize.
If it is NULL, function GetUnicodeStringTextAndSize will return
EFI_OUT_OF_RESOURCES, and error handling codes will cover it.
So the pointer 'Sting' can not be NULL when using it.
So we can add the ASSERT codes.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c

index 03f814119993f3f57a77e0906584d5a85392b61d..66823197111a650966dfb5b63522e23320e96b49 100644 (file)
@@ -875,7 +875,7 @@ GetStringIdFromString (
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
-      \r
+      ASSERT (String != NULL);\r
       if (StrCmp(KeywordValue, String) == 0) {\r
         *StringId = CurrentStringId;\r
         goto Done;\r
@@ -895,7 +895,7 @@ GetStringIdFromString (
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
-      \r
+      ASSERT (String != NULL);\r
       if (StrCmp(KeywordValue, String) == 0) {\r
         *StringId = CurrentStringId;\r
         goto Done;\r
@@ -914,7 +914,7 @@ GetStringIdFromString (
         if (EFI_ERROR (Status)) {\r
           goto Done;\r
         }\r
-\r
+        ASSERT (String != NULL);\r
         BlockSize += StringSize;\r
         if (StrCmp(KeywordValue, String) == 0) {\r
           *StringId = CurrentStringId;\r
@@ -939,7 +939,7 @@ GetStringIdFromString (
         if (EFI_ERROR (Status)) {\r
           goto Done;\r
         }\r
-\r
+        ASSERT (String != NULL);\r
         BlockSize += StringSize;\r
         if (StrCmp(KeywordValue, String) == 0) {\r
           *StringId = CurrentStringId;\r