]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c
Update Performance library instances to adapt to the update in Performance infrastruc...
[mirror_edk2.git] / MdeModulePkg / Library / UefiIfrSupportLib / UefiIfrForm.c
index 1584c33d92a661fa88eda3768a0b1380106599fa..9e6d3382f70682e6fa80e684e70ba650c91069fb 100644 (file)
@@ -973,6 +973,11 @@ ConstructConfigHdr (
   CHAR16                    *StrPtr;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
 \r
+  //\r
+  // Make sure when ConfigHdr is NULL, StrBufferlen must be 0\r
+  //\r
+  ASSERT (!(ConfigHdr == NULL && *StrBufferLen != 0));\r
+\r
   if (Name == NULL) {\r
     //\r
     // There will be no "NAME" in <ConfigHdr> for  Name/Value storage\r
@@ -1004,7 +1009,7 @@ ConstructConfigHdr (
   // | 5  |   32   |  6  |  NameStrLen*4 |  6  |    DevicePathStrLen    | 1 |\r
   //\r
   BufferSize = (5 + 32 + 6 + NameStrLen * 4 + 6 + DevicePathSize * 2 + 1) * sizeof (CHAR16);\r
-  if (*StrBufferLen < BufferSize) {\r
+  if ((*StrBufferLen == 0) || *StrBufferLen < BufferSize) {\r
     *StrBufferLen = BufferSize;\r
     return EFI_BUFFER_TOO_SMALL;\r
   }\r