]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDebugLibConOut/DebugLib.c
NetworkPkg/HttpDxe: Set the HostName for the verification (CVE-2019-14553)
[mirror_edk2.git] / MdePkg / Library / UefiDebugLibConOut / DebugLib.c
index c430419c998ab927db6860a7bf1b506033d1f5fa..cf168d05cf21d18d0a687948a68a3192de105642 100644 (file)
@@ -9,7 +9,6 @@
 #include <Uefi.h>\r
 \r
 #include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/PrintLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/BaseLib.h>\r
@@ -27,6 +26,9 @@
 //\r
 VA_LIST     mVaListNull;\r
 \r
+extern BOOLEAN                mPostEBS;\r
+extern EFI_SYSTEM_TABLE       *mDebugST;\r
+\r
 /**\r
   Prints a debug message to the debug output device if the specified error level is enabled.\r
 \r
@@ -85,33 +87,35 @@ DebugPrintMarker (
 {\r
   CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
 \r
-  //\r
-  // If Format is NULL, then ASSERT().\r
-  //\r
-  ASSERT (Format != NULL);\r
-\r
-  //\r
-  // Check driver debug mask value and global mask\r
-  //\r
-  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
-    return;\r
-  }\r
-\r
-  //\r
-  // Convert the DEBUG() message to a Unicode String\r
-  //\r
-  if (BaseListMarker == NULL) {\r
-    UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, VaListMarker);\r
-  } else {\r
-    UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, BaseListMarker);\r
-  }\r
-\r
-\r
-  //\r
-  // Send the print string to the Console Output device\r
-  //\r
-  if ((gST != NULL) && (gST->ConOut != NULL)) {\r
-    gST->ConOut->OutputString (gST->ConOut, Buffer);\r
+  if (!mPostEBS) {\r
+    //\r
+    // If Format is NULL, then ASSERT().\r
+    //\r
+    ASSERT (Format != NULL);\r
+\r
+    //\r
+    // Check driver debug mask value and global mask\r
+    //\r
+    if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
+      return;\r
+    }\r
+\r
+    //\r
+    // Convert the DEBUG() message to a Unicode String\r
+    //\r
+    if (BaseListMarker == NULL) {\r
+      UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, VaListMarker);\r
+    } else {\r
+      UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, BaseListMarker);\r
+    }\r
+\r
+\r
+    //\r
+    // Send the print string to the Console Output device\r
+    //\r
+    if ((mDebugST != NULL) && (mDebugST->ConOut != NULL)) {\r
+      mDebugST->ConOut->OutputString (mDebugST->ConOut, Buffer);\r
+    }\r
   }\r
 }\r
 \r
@@ -205,33 +209,35 @@ DebugAssert (
 {\r
   CHAR16  Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
 \r
-  //\r
-  // Generate the ASSERT() message in Unicode format\r
-  //\r
-  UnicodeSPrintAsciiFormat (\r
-    Buffer,\r
-    sizeof (Buffer),\r
-    "ASSERT [%a] %a(%d): %a\n",\r
-    gEfiCallerBaseName,\r
-    FileName,\r
-    LineNumber,\r
-    Description\r
-    );\r
-\r
-  //\r
-  // Send the print string to the Console Output device\r
-  //\r
-  if ((gST != NULL) && (gST->ConOut != NULL)) {\r
-    gST->ConOut->OutputString (gST->ConOut, Buffer);\r
-  }\r
-\r
-  //\r
-  // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
-  //\r
-  if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
-    CpuBreakpoint ();\r
-  } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
-    CpuDeadLoop ();\r
+  if (!mPostEBS) {\r
+    //\r
+    // Generate the ASSERT() message in Unicode format\r
+    //\r
+    UnicodeSPrintAsciiFormat (\r
+      Buffer,\r
+      sizeof (Buffer),\r
+      "ASSERT [%a] %a(%d): %a\n",\r
+      gEfiCallerBaseName,\r
+      FileName,\r
+      LineNumber,\r
+      Description\r
+      );\r
+\r
+    //\r
+    // Send the print string to the Console Output device\r
+    //\r
+    if ((mDebugST != NULL) && (mDebugST->ConOut != NULL)) {\r
+      mDebugST->ConOut->OutputString (mDebugST->ConOut, Buffer);\r
+    }\r
+\r
+    //\r
+    // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
+    //\r
+    if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
+      CpuBreakpoint ();\r
+    } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
+      CpuDeadLoop ();\r
+    }\r
   }\r
 }\r
 \r